Class TransformationException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.google.android.exoplayer2.transformer.TransformationException
-
- All Implemented Interfaces:
Serializable
public final class TransformationException extends Exception
Thrown when a non-locally recoverable transformation failure occurs.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TransformationException.ErrorCode
Codes that identify causes ofTransformer
errors.
-
Field Summary
Fields Modifier and Type Field Description static int
ERROR_CODE_DECODER_INIT_FAILED
Caused by a decoder initialization failure.static int
ERROR_CODE_DECODING_FAILED
Caused by a failure while trying to decode media samples.static int
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
Caused by trying to decode content whose format is not supported.static int
ERROR_CODE_ENCODER_INIT_FAILED
Caused by an encoder initialization failure.static int
ERROR_CODE_ENCODING_FAILED
Caused by a failure while trying to encode media samples.static int
ERROR_CODE_FAILED_RUNTIME_CHECK
Caused by a failed runtime check.static int
ERROR_CODE_FRAME_PROCESSING_FAILED
Caused by a frame processing failure.static int
ERROR_CODE_HDR_DECODING_UNSUPPORTED
Caused by the decoder not supporting HDR formats.static int
ERROR_CODE_HDR_ENCODING_UNSUPPORTED
Caused by the encoder not supporting HDR formats.static int
ERROR_CODE_IO_BAD_HTTP_STATUS
Caused by an HTTP server returning an unexpected HTTP response status code.static int
ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED
Caused by the player trying to access cleartext HTTP traffic (meaning http:// rather than https://) when the app's Network Security Configuration does not permit it.static int
ERROR_CODE_IO_FILE_NOT_FOUND
Caused by a non-existent file.static int
ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE
Caused by a server returning a resource with an invalid "Content-Type" HTTP header value.static int
ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
Caused by a network connection failure.static int
ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
Caused by a network timeout, meaning the server is taking too long to fulfill a request.static int
ERROR_CODE_IO_NO_PERMISSION
Caused by lack of permission to perform an IO operation.static int
ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
Caused by reading data out of the data bound.static int
ERROR_CODE_IO_UNSPECIFIED
Caused by an Input/Output error which could not be identified.static int
ERROR_CODE_MUXING_FAILED
Caused by a failure while muxing media samples.static int
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED
Caused by the output format for a track not being supported.static int
ERROR_CODE_UNSPECIFIED
Caused by an error whose cause could not be identified.@com.google.android.exoplayer2.transformer.TransformationException.ErrorCode int
errorCode
An error code which identifies the cause of the transformation failure.long
timestampMs
The value ofSystemClock.elapsedRealtime()
when this exception was created.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TransformationException
createForAudioProcessor(Throwable cause, String componentName, AudioProcessor.AudioFormat audioFormat, int errorCode)
Creates an instance for anAudioProcessor
related exception.static TransformationException
createForCodec(Throwable cause, boolean isVideo, boolean isDecoder, MediaFormat mediaFormat, String mediaCodecName, int errorCode)
Creates an instance for a decoder or encoder related exception.static TransformationException
createForCodec(Throwable cause, boolean isVideo, boolean isDecoder, Format format, String mediaCodecName, int errorCode)
Creates an instance for a decoder or encoder related exception.static TransformationException
createForUnexpected(Exception cause)
Creates an instance for an unexpected exception.boolean
errorInfoEquals(TransformationException other)
Returns whether the error data associated to this exception equals the error data associated toother
.String
getErrorCodeName()
Equivalent toTransformationException.getErrorCodeName(this.errorCode)
.static String
getErrorCodeName(@com.google.android.exoplayer2.transformer.TransformationException.ErrorCode int errorCode)
Returns the name of a givenerrorCode
.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
ERROR_CODE_UNSPECIFIED
public static final int ERROR_CODE_UNSPECIFIED
Caused by an error whose cause could not be identified.- See Also:
- Constant Field Values
-
ERROR_CODE_FAILED_RUNTIME_CHECK
public static final int ERROR_CODE_FAILED_RUNTIME_CHECK
Caused by a failed runtime check.This can happen when transformer reaches an invalid state.
- See Also:
- Constant Field Values
-
ERROR_CODE_IO_UNSPECIFIED
public static final int ERROR_CODE_IO_UNSPECIFIED
Caused by an Input/Output error which could not be identified.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
public static final int ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
Caused by a network connection failure.The following is a non-exhaustive list of possible reasons:
- There is no network connectivity.
- The URL's domain is misspelled or does not exist.
- The target host is unreachable.
- The server unexpectedly closes the connection.
- See Also:
- Constant Field Values
-
ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
public static final int ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT
Caused by a network timeout, meaning the server is taking too long to fulfill a request.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE
public static final int ERROR_CODE_IO_INVALID_HTTP_CONTENT_TYPE
Caused by a server returning a resource with an invalid "Content-Type" HTTP header value.For example, this can happen when the player is expecting a piece of media, but the server returns a paywall HTML page, with content type "text/html".
- See Also:
- Constant Field Values
-
ERROR_CODE_IO_BAD_HTTP_STATUS
public static final int ERROR_CODE_IO_BAD_HTTP_STATUS
Caused by an HTTP server returning an unexpected HTTP response status code.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_FILE_NOT_FOUND
public static final int ERROR_CODE_IO_FILE_NOT_FOUND
Caused by a non-existent file.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_NO_PERMISSION
public static final int ERROR_CODE_IO_NO_PERMISSION
Caused by lack of permission to perform an IO operation. For example, lack of permission to access internet or external storage.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED
public static final int ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED
Caused by the player trying to access cleartext HTTP traffic (meaning http:// rather than https://) when the app's Network Security Configuration does not permit it.- See Also:
- Constant Field Values
-
ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
public static final int ERROR_CODE_IO_READ_POSITION_OUT_OF_RANGE
Caused by reading data out of the data bound.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODER_INIT_FAILED
public static final int ERROR_CODE_DECODER_INIT_FAILED
Caused by a decoder initialization failure.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODING_FAILED
public static final int ERROR_CODE_DECODING_FAILED
Caused by a failure while trying to decode media samples.- See Also:
- Constant Field Values
-
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
public static final int ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
Caused by trying to decode content whose format is not supported.- See Also:
- Constant Field Values
-
ERROR_CODE_HDR_DECODING_UNSUPPORTED
public static final int ERROR_CODE_HDR_DECODING_UNSUPPORTED
Caused by the decoder not supporting HDR formats.- See Also:
- Constant Field Values
-
ERROR_CODE_ENCODER_INIT_FAILED
public static final int ERROR_CODE_ENCODER_INIT_FAILED
Caused by an encoder initialization failure.- See Also:
- Constant Field Values
-
ERROR_CODE_ENCODING_FAILED
public static final int ERROR_CODE_ENCODING_FAILED
Caused by a failure while trying to encode media samples.- See Also:
- Constant Field Values
-
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED
public static final int ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED
Caused by the output format for a track not being supported.Supported output formats are limited by the muxer's capabilities and the encoders available.
- See Also:
- Constant Field Values
-
ERROR_CODE_HDR_ENCODING_UNSUPPORTED
public static final int ERROR_CODE_HDR_ENCODING_UNSUPPORTED
Caused by the encoder not supporting HDR formats.- See Also:
- Constant Field Values
-
ERROR_CODE_FRAME_PROCESSING_FAILED
public static final int ERROR_CODE_FRAME_PROCESSING_FAILED
Caused by a frame processing failure.- See Also:
- Constant Field Values
-
ERROR_CODE_MUXING_FAILED
public static final int ERROR_CODE_MUXING_FAILED
Caused by a failure while muxing media samples.- See Also:
- Constant Field Values
-
errorCode
public final @com.google.android.exoplayer2.transformer.TransformationException.ErrorCode int errorCode
An error code which identifies the cause of the transformation failure.
-
timestampMs
public final long timestampMs
The value ofSystemClock.elapsedRealtime()
when this exception was created.
-
-
Method Detail
-
getErrorCodeName
public static String getErrorCodeName(@com.google.android.exoplayer2.transformer.TransformationException.ErrorCode int errorCode)
Returns the name of a givenerrorCode
.
-
getErrorCodeName
public String getErrorCodeName()
Equivalent toTransformationException.getErrorCodeName(this.errorCode)
.
-
createForCodec
public static TransformationException createForCodec(Throwable cause, boolean isVideo, boolean isDecoder, MediaFormat mediaFormat, @Nullable String mediaCodecName, int errorCode)
Creates an instance for a decoder or encoder related exception.Use this method after the
MediaFormat
used to configure theCodec
is known.- Parameters:
cause
- The cause of the failure.isVideo
- Whether the decoder or encoder is configured for video.isDecoder
- Whether the exception is created for a decoder.mediaFormat
- TheMediaFormat
used for configuring the underlyingMediaCodec
.mediaCodecName
- The name of theMediaCodec
used, if known.errorCode
- SeeerrorCode
.- Returns:
- The created instance.
-
createForCodec
public static TransformationException createForCodec(Throwable cause, boolean isVideo, boolean isDecoder, Format format, @Nullable String mediaCodecName, int errorCode)
Creates an instance for a decoder or encoder related exception.Use this method before configuring the
Codec
, or when theCodec
is not configured with aMediaFormat
.- Parameters:
cause
- The cause of the failure.isVideo
- Whether the decoder or encoder is configured for video.isDecoder
- Whether the exception is created for a decoder.format
- TheFormat
used for configuring theCodec
.mediaCodecName
- The name of theMediaCodec
used, if known.errorCode
- SeeerrorCode
.- Returns:
- The created instance.
-
createForAudioProcessor
public static TransformationException createForAudioProcessor(Throwable cause, String componentName, AudioProcessor.AudioFormat audioFormat, int errorCode)
Creates an instance for anAudioProcessor
related exception.- Parameters:
cause
- The cause of the failure.componentName
- The name of theAudioProcessor
used.audioFormat
- TheAudioProcessor.AudioFormat
used.errorCode
- SeeerrorCode
.- Returns:
- The created instance.
-
createForUnexpected
public static TransformationException createForUnexpected(Exception cause)
Creates an instance for an unexpected exception.If the exception is a runtime exception, error code
ERROR_CODE_FAILED_RUNTIME_CHECK
is used. Otherwise, the created instance has error codeERROR_CODE_UNSPECIFIED
.- Parameters:
cause
- The cause of the failure.- Returns:
- The created instance.
-
errorInfoEquals
public boolean errorInfoEquals(@Nullable TransformationException other)
Returns whether the error data associated to this exception equals the error data associated toother
.Note that this method does not compare the exceptions' stack traces.
-
-