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
a24bbbdd
authored
Jul 01, 2021
by
aquilescanta
Committed by
kim-vde
Jul 09, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Reimplement getErrorCodeFromPlatformDiagnosticsInfo to save the pattern
PiperOrigin-RevId: 382494191
parent
91cb54b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
a24bbbdd
...
@@ -145,9 +145,6 @@ public final class Util {
...
@@ -145,9 +145,6 @@ public final class Util {
+
"(T(([0-9]*)H)?(([0-9]*)M)?(([0-9.]*)S)?)?$"
);
+
"(T(([0-9]*)H)?(([0-9]*)M)?(([0-9.]*)S)?)?$"
);
private
static
final
Pattern
ESCAPED_CHARACTER_PATTERN
=
Pattern
.
compile
(
"%([A-Fa-f0-9]{2})"
);
private
static
final
Pattern
ESCAPED_CHARACTER_PATTERN
=
Pattern
.
compile
(
"%([A-Fa-f0-9]{2})"
);
/** Pattern to extract error code from platform diagnostics info. */
private
static
final
Pattern
DIAGNOSTIC_INFO_CODE_PATTERN
=
Pattern
.
compile
(
".*?_(neg_|)(\\d+)"
);
// https://docs.microsoft.com/en-us/azure/media-services/previous/media-services-deliver-content-overview#URLs.
// https://docs.microsoft.com/en-us/azure/media-services/previous/media-services-deliver-content-overview#URLs.
private
static
final
Pattern
ISM_URL_PATTERN
=
Pattern
.
compile
(
".*\\.isml?(?:/(manifest(.*))?)?"
);
private
static
final
Pattern
ISM_URL_PATTERN
=
Pattern
.
compile
(
".*\\.isml?(?:/(manifest(.*))?)?"
);
private
static
final
String
ISM_HLS_FORMAT_EXTENSION
=
"format=m3u8-aapl"
;
private
static
final
String
ISM_HLS_FORMAT_EXTENSION
=
"format=m3u8-aapl"
;
...
@@ -2382,19 +2379,27 @@ public final class Util {
...
@@ -2382,19 +2379,27 @@ public final class Util {
/**
/**
* Attempts to parse an error code from a diagnostic string found in framework media exceptions.
* Attempts to parse an error code from a diagnostic string found in framework media exceptions.
* For example: android.media.MediaCodec.error_1 or android.media.MediaDrm.error_neg_2.
*
* <p>For example: android.media.MediaCodec.error_1 or android.media.MediaDrm.error_neg_2.
*
* @param diagnosticsInfo A string from which to parse the error code.
* @return The parser error code, or 0 if an error code could not be parsed.
*/
*/
public
static
int
getErrorCodeFromPlatformDiagnosticsInfo
(
@Nullable
String
diagnosticsInfo
)
{
public
static
int
getErrorCodeFromPlatformDiagnosticsInfo
(
@Nullable
String
diagnosticsInfo
)
{
// TODO (internal b/192337376): Change 0 for ERROR_UNKNOWN once available.
if
(
diagnosticsInfo
==
null
)
{
if
(
diagnosticsInfo
==
null
)
{
return
0
;
return
0
;
}
}
Matcher
matcher
=
DIAGNOSTIC_INFO_CODE_PATTERN
.
matcher
(
diagnosticsInfo
);
String
[]
strings
=
split
(
diagnosticsInfo
,
"_"
);
if
(!
matcher
.
matches
())
{
int
length
=
strings
.
length
;
if
(
length
<
2
)
{
return
0
;
return
0
;
}
}
String
digitsSection
=
strings
[
length
-
1
];
boolean
isNegative
=
length
>=
3
&&
"neg"
.
equals
(
strings
[
length
-
2
]);
try
{
try
{
int
errorCode
=
Integer
.
parseInt
(
Assertions
.
checkNotNull
(
matcher
.
group
(
2
)
));
int
errorCode
=
Integer
.
parseInt
(
Assertions
.
checkNotNull
(
digitsSection
));
return
Assertions
.
checkNotNull
(
matcher
.
group
(
1
)).
isEmpty
()
?
errorCode
:
-
errorCode
;
return
isNegative
?
-
errorCode
:
errorCode
;
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
return
0
;
return
0
;
}
}
...
...
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