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
36841d4f
authored
Jun 03, 2021
by
aquilescanta
Committed by
bachinger
Jun 03, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Replace one of the ParserException constructors with factory method
PiperOrigin-RevId: 377281961
parent
bb2e0bc0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
19 deletions
library/common/src/main/java/com/google/android/exoplayer2/ParserException.java
library/common/src/main/java/com/google/android/exoplayer2/video/AvcConfig.java
library/common/src/main/java/com/google/android/exoplayer2/video/HevcConfig.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DataSchemeDataSource.java
library/common/src/main/java/com/google/android/exoplayer2/ParserException.java
View file @
36841d4f
...
...
@@ -24,6 +24,19 @@ public class ParserException extends IOException {
/**
* Creates a new instance for which {@link #contentIsMalformed} is true and {@link #dataType} is
* {@link C#DATA_TYPE_UNKNOWN}.
*
* @param message See {@link #getMessage()}.
* @param cause See {@link #getCause()}.
* @return The created instance.
*/
public
static
ParserException
createForMalformedDataOfUnknownType
(
@Nullable
String
message
,
@Nullable
Throwable
cause
)
{
return
new
ParserException
(
message
,
cause
,
/* contentIsMalformed= */
true
,
C
.
DATA_TYPE_UNKNOWN
);
}
/**
* Creates a new instance for which {@link #contentIsMalformed} is true and {@link #dataType} is
* {@link C#DATA_TYPE_MEDIA}.
*
* @param message See {@link #getMessage()}.
...
...
@@ -91,7 +104,11 @@ public class ParserException extends IOException {
*/
@Deprecated
public
ParserException
()
{
this
(
/* message= */
null
,
/* cause= */
null
);
this
(
/* message= */
null
,
/* cause= */
null
,
/* contentIsMalformed= */
true
,
C
.
DATA_TYPE_UNKNOWN
);
}
/**
...
...
@@ -103,7 +120,7 @@ public class ParserException extends IOException {
*/
@Deprecated
public
ParserException
(
String
message
)
{
this
(
message
,
/* cause= */
null
);
this
(
message
,
/* cause= */
null
,
/* contentIsMalformed= */
true
,
C
.
DATA_TYPE_UNKNOWN
);
}
/**
...
...
@@ -115,20 +132,7 @@ public class ParserException extends IOException {
*/
@Deprecated
public
ParserException
(
Throwable
cause
)
{
this
(
/* message= */
null
,
cause
);
}
/**
* Creates a new instance.
*
* @param message The detail message for the exception.
* @param cause The cause for the exception.
* @deprecated Use a factory method which initializes {@link #contentIsMalformed}, and {@link
* #dataType} instead.
*/
@Deprecated
public
ParserException
(
@Nullable
String
message
,
@Nullable
Throwable
cause
)
{
this
(
message
,
cause
,
/* contentIsMalformed= */
true
,
C
.
DATA_TYPE_UNKNOWN
);
this
(
/* message= */
null
,
cause
,
/* contentIsMalformed= */
true
,
C
.
DATA_TYPE_UNKNOWN
);
}
private
ParserException
(
...
...
library/common/src/main/java/com/google/android/exoplayer2/video/AvcConfig.java
View file @
36841d4f
...
...
@@ -85,7 +85,7 @@ public final class AvcConfig {
pixelWidthAspectRatio
,
codecs
);
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
throw
new
ParserException
(
"Error parsing AVC config"
,
e
);
throw
ParserException
.
createForMalformedContainer
(
"Error parsing AVC config"
,
e
);
}
}
...
...
library/common/src/main/java/com/google/android/exoplayer2/video/HevcConfig.java
View file @
36841d4f
...
...
@@ -90,7 +90,7 @@ public final class HevcConfig {
List
<
byte
[]>
initializationData
=
csdLength
==
0
?
null
:
Collections
.
singletonList
(
buffer
);
return
new
HevcConfig
(
initializationData
,
lengthSizeMinusOne
+
1
,
codecs
);
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
throw
new
ParserException
(
"Error parsing HEVC config"
,
e
);
throw
ParserException
.
createForMalformedContainer
(
"Error parsing HEVC config"
,
e
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DataSchemeDataSource.java
View file @
36841d4f
...
...
@@ -60,7 +60,8 @@ public final class DataSchemeDataSource extends BaseDataSource {
try
{
data
=
Base64
.
decode
(
dataString
,
/* flags= */
Base64
.
DEFAULT
);
}
catch
(
IllegalArgumentException
e
)
{
throw
new
ParserException
(
"Error while parsing Base64 encoded string: "
+
dataString
,
e
);
throw
ParserException
.
createForMalformedDataOfUnknownType
(
"Error while parsing Base64 encoded string: "
+
dataString
,
e
);
}
}
else
{
// TODO: Add support for other charsets.
...
...
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