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
b66af202
authored
Feb 10, 2022
by
claincly
Committed by
Ian Baker
Feb 17, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add logging for exceptions thrown while configuring MediaCodec.
PiperOrigin-RevId: 427728320
parent
3540b9d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultCodec.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/DefaultCodec.java
View file @
b66af202
...
...
@@ -106,7 +106,7 @@ public final class DefaultCodec implements Codec {
}
throw
createInitializationTransformationException
(
e
,
configurationFormat
,
isVideo
,
isDecoder
,
mediaCodecName
);
e
,
mediaFormat
,
configurationFormat
,
isVideo
,
isDecoder
,
mediaCodecName
);
}
this
.
mediaCodec
=
mediaCodec
;
this
.
inputSurface
=
inputSurface
;
...
...
@@ -297,6 +297,7 @@ public final class DefaultCodec implements Codec {
private
static
TransformationException
createInitializationTransformationException
(
Exception
cause
,
MediaFormat
mediaFormat
,
Format
format
,
boolean
isVideo
,
boolean
isDecoder
,
...
...
@@ -304,6 +305,7 @@ public final class DefaultCodec implements Codec {
if
(
cause
instanceof
IOException
||
cause
instanceof
MediaCodec
.
CodecException
)
{
return
TransformationException
.
createForCodec
(
cause
,
mediaFormat
,
format
,
isVideo
,
isDecoder
,
...
...
@@ -315,6 +317,7 @@ public final class DefaultCodec implements Codec {
if
(
cause
instanceof
IllegalArgumentException
)
{
return
TransformationException
.
createForCodec
(
cause
,
mediaFormat
,
format
,
isVideo
,
isDecoder
,
...
...
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java
View file @
b66af202
...
...
@@ -18,6 +18,7 @@ package com.google.android.exoplayer2.transformer;
import
static
java
.
lang
.
annotation
.
ElementType
.
TYPE_USE
;
import
android.media.MediaCodec
;
import
android.media.MediaFormat
;
import
android.os.SystemClock
;
import
androidx.annotation.IntDef
;
import
androidx.annotation.Nullable
;
...
...
@@ -205,7 +206,9 @@ public final class TransformationException extends Exception {
* Creates an instance for a decoder or encoder related exception.
*
* @param cause The cause of the failure.
* @param format The {@link Format} used for configuring the decoder/encoder.
* @param mediaFormat The {@link MediaFormat} used for configuring the underlying {@link
* MediaCodec}, if known.
* @param format The {@link Format} used for configuring the {@link Codec}.
* @param isVideo Whether the decoder or encoder is configured for video.
* @param isDecoder Whether the exception is created for a decoder.
* @param mediaCodecName The name of the {@link MediaCodec} used, if known.
...
...
@@ -214,16 +217,44 @@ public final class TransformationException extends Exception {
*/
public
static
TransformationException
createForCodec
(
Throwable
cause
,
@Nullable
MediaFormat
mediaFormat
,
Format
format
,
boolean
isVideo
,
boolean
isDecoder
,
@Nullable
String
mediaCodecName
,
int
errorCode
)
{
String
componentName
=
(
isVideo
?
"Video"
:
"Audio"
)
+
(
isDecoder
?
"Decoder"
:
"Encoder"
);
return
new
TransformationException
(
componentName
+
" error, format = "
+
format
+
", mediaCodecName="
+
mediaCodecName
,
cause
,
errorCode
);
String
errorMessage
=
componentName
+
" error, format="
+
format
+
", mediaCodecName="
+
mediaCodecName
+
", mediaFormat="
+
(
mediaFormat
==
null
?
"no configured MediaFormat"
:
mediaFormat
.
toString
());
return
new
TransformationException
(
errorMessage
,
cause
,
errorCode
);
}
/**
* Creates an instance for a decoder or encoder related exception.
*
* @param cause The cause of the failure.
* @param format The {@link Format} used for configuring the {@link Codec}.
* @param isVideo Whether the decoder or encoder is configured for video.
* @param isDecoder Whether the exception is created for a decoder.
* @param mediaCodecName The name of the {@link MediaCodec} used, if known.
* @param errorCode See {@link #errorCode}.
* @return The created instance.
*/
public
static
TransformationException
createForCodec
(
Throwable
cause
,
Format
format
,
boolean
isVideo
,
boolean
isDecoder
,
@Nullable
String
mediaCodecName
,
int
errorCode
)
{
return
createForCodec
(
cause
,
/* mediaFormat= */
null
,
format
,
isVideo
,
isDecoder
,
mediaCodecName
,
errorCode
);
}
/**
...
...
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