Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c59fc475
authored
Oct 26, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Throw ParserException from parsers when a parse exception occurs.
parent
13aaa5a5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
34 deletions
library/src/main/java/com/google/android/exoplayer/ParserException.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/FragmentedMp4Extractor.java
library/src/main/java/com/google/android/exoplayer/extractor/webm/DefaultEbmlReader.java
library/src/main/java/com/google/android/exoplayer/extractor/webm/WebmExtractor.java
library/src/main/java/com/google/android/exoplayer/ParserException.java
View file @
c59fc475
...
@@ -22,6 +22,10 @@ import java.io.IOException;
...
@@ -22,6 +22,10 @@ import java.io.IOException;
*/
*/
public
class
ParserException
extends
IOException
{
public
class
ParserException
extends
IOException
{
public
ParserException
()
{
super
();
}
public
ParserException
(
String
message
)
{
public
ParserException
(
String
message
)
{
super
(
message
);
super
(
message
);
}
}
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/FragmentedMp4Extractor.java
View file @
c59fc475
This diff is collapsed.
Click to expand it.
library/src/main/java/com/google/android/exoplayer/extractor/webm/DefaultEbmlReader.java
View file @
c59fc475
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer
.
extractor
.
webm
;
package
com
.
google
.
android
.
exoplayer
.
extractor
.
webm
;
import
com.google.android.exoplayer.C
;
import
com.google.android.exoplayer.C
;
import
com.google.android.exoplayer.ParserException
;
import
com.google.android.exoplayer.extractor.ExtractorInput
;
import
com.google.android.exoplayer.extractor.ExtractorInput
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.Assertions
;
...
@@ -100,7 +101,7 @@ import java.util.Stack;
...
@@ -100,7 +101,7 @@ import java.util.Stack;
return
true
;
return
true
;
case
TYPE_UNSIGNED_INT:
case
TYPE_UNSIGNED_INT:
if
(
elementContentSize
>
MAX_INTEGER_ELEMENT_SIZE_BYTES
)
{
if
(
elementContentSize
>
MAX_INTEGER_ELEMENT_SIZE_BYTES
)
{
throw
new
IllegalState
Exception
(
"Invalid integer size: "
+
elementContentSize
);
throw
new
Parser
Exception
(
"Invalid integer size: "
+
elementContentSize
);
}
}
output
.
integerElement
(
elementId
,
readInteger
(
input
,
(
int
)
elementContentSize
));
output
.
integerElement
(
elementId
,
readInteger
(
input
,
(
int
)
elementContentSize
));
elementState
=
ELEMENT_STATE_READ_ID
;
elementState
=
ELEMENT_STATE_READ_ID
;
...
@@ -108,14 +109,14 @@ import java.util.Stack;
...
@@ -108,14 +109,14 @@ import java.util.Stack;
case
TYPE_FLOAT:
case
TYPE_FLOAT:
if
(
elementContentSize
!=
VALID_FLOAT32_ELEMENT_SIZE_BYTES
if
(
elementContentSize
!=
VALID_FLOAT32_ELEMENT_SIZE_BYTES
&&
elementContentSize
!=
VALID_FLOAT64_ELEMENT_SIZE_BYTES
)
{
&&
elementContentSize
!=
VALID_FLOAT64_ELEMENT_SIZE_BYTES
)
{
throw
new
IllegalState
Exception
(
"Invalid float size: "
+
elementContentSize
);
throw
new
Parser
Exception
(
"Invalid float size: "
+
elementContentSize
);
}
}
output
.
floatElement
(
elementId
,
readFloat
(
input
,
(
int
)
elementContentSize
));
output
.
floatElement
(
elementId
,
readFloat
(
input
,
(
int
)
elementContentSize
));
elementState
=
ELEMENT_STATE_READ_ID
;
elementState
=
ELEMENT_STATE_READ_ID
;
return
true
;
return
true
;
case
TYPE_STRING:
case
TYPE_STRING:
if
(
elementContentSize
>
Integer
.
MAX_VALUE
)
{
if
(
elementContentSize
>
Integer
.
MAX_VALUE
)
{
throw
new
IllegalState
Exception
(
"String element size: "
+
elementContentSize
);
throw
new
Parser
Exception
(
"String element size: "
+
elementContentSize
);
}
}
output
.
stringElement
(
elementId
,
readString
(
input
,
(
int
)
elementContentSize
));
output
.
stringElement
(
elementId
,
readString
(
input
,
(
int
)
elementContentSize
));
elementState
=
ELEMENT_STATE_READ_ID
;
elementState
=
ELEMENT_STATE_READ_ID
;
...
@@ -129,7 +130,7 @@ import java.util.Stack;
...
@@ -129,7 +130,7 @@ import java.util.Stack;
elementState
=
ELEMENT_STATE_READ_ID
;
elementState
=
ELEMENT_STATE_READ_ID
;
break
;
break
;
default
:
default
:
throw
new
IllegalState
Exception
(
"Invalid element type "
+
type
);
throw
new
Parser
Exception
(
"Invalid element type "
+
type
);
}
}
}
}
}
}
...
...
library/src/main/java/com/google/android/exoplayer/extractor/webm/WebmExtractor.java
View file @
c59fc475
...
@@ -26,7 +26,6 @@ import com.google.android.exoplayer.extractor.ExtractorOutput;
...
@@ -26,7 +26,6 @@ import com.google.android.exoplayer.extractor.ExtractorOutput;
import
com.google.android.exoplayer.extractor.PositionHolder
;
import
com.google.android.exoplayer.extractor.PositionHolder
;
import
com.google.android.exoplayer.extractor.SeekMap
;
import
com.google.android.exoplayer.extractor.SeekMap
;
import
com.google.android.exoplayer.extractor.TrackOutput
;
import
com.google.android.exoplayer.extractor.TrackOutput
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.LongArray
;
import
com.google.android.exoplayer.util.LongArray
;
import
com.google.android.exoplayer.util.MimeTypes
;
import
com.google.android.exoplayer.util.MimeTypes
;
import
com.google.android.exoplayer.util.NalUnitUtil
;
import
com.google.android.exoplayer.util.NalUnitUtil
;
...
@@ -738,7 +737,7 @@ public final class WebmExtractor implements Extractor {
...
@@ -738,7 +737,7 @@ public final class WebmExtractor implements Extractor {
contentSize
-
blockTrackNumberLength
-
headerSize
-
totalSamplesSize
;
contentSize
-
blockTrackNumberLength
-
headerSize
-
totalSamplesSize
;
}
else
{
}
else
{
// Lacing is always in the range 0--3.
// Lacing is always in the range 0--3.
throw
new
IllegalState
Exception
(
"Unexpected lacing value: "
+
lacing
);
throw
new
Parser
Exception
(
"Unexpected lacing value: "
+
lacing
);
}
}
}
}
...
@@ -1257,7 +1256,9 @@ public final class WebmExtractor implements Extractor {
...
@@ -1257,7 +1256,9 @@ public final class WebmExtractor implements Extractor {
// TODO: Deduplicate with AtomParsers.parseAvcCFromParent.
// TODO: Deduplicate with AtomParsers.parseAvcCFromParent.
buffer
.
setPosition
(
4
);
buffer
.
setPosition
(
4
);
int
nalUnitLengthFieldLength
=
(
buffer
.
readUnsignedByte
()
&
0x03
)
+
1
;
int
nalUnitLengthFieldLength
=
(
buffer
.
readUnsignedByte
()
&
0x03
)
+
1
;
Assertions
.
checkState
(
nalUnitLengthFieldLength
!=
3
);
if
(
nalUnitLengthFieldLength
==
3
)
{
throw
new
ParserException
();
}
List
<
byte
[]>
initializationData
=
new
ArrayList
<>();
List
<
byte
[]>
initializationData
=
new
ArrayList
<>();
int
numSequenceParameterSets
=
buffer
.
readUnsignedByte
()
&
0x1F
;
int
numSequenceParameterSets
=
buffer
.
readUnsignedByte
()
&
0x1F
;
for
(
int
i
=
0
;
i
<
numSequenceParameterSets
;
i
++)
{
for
(
int
i
=
0
;
i
<
numSequenceParameterSets
;
i
++)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment