Commit e9a30773 by huangdarwin Committed by Ian Baker

Transformer: Rename error code from output to encoding format.

Rename ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED to
ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED.

This makes the error code more consistent with ERROR_CODE_DECODING_FAILED on the
decoding side. Also, the error code is in the "Encoding errors (4xxx)" section,
so muxer errors probably should be in the "Muxer errors (7xxx)" section instead.

Additionally, no muxer errors currently seem to use
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED, so this should be a safe change.

PiperOrigin-RevId: 493322880
parent 5277171d
...@@ -47,7 +47,7 @@ import com.google.android.exoplayer2.util.MimeTypes; ...@@ -47,7 +47,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
/* isDecoder= */ false, /* isDecoder= */ false,
requestedEncoderFormat, requestedEncoderFormat,
/* mediaCodecName= */ null, /* mediaCodecName= */ null,
TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED); TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
} }
@Override @Override
......
...@@ -405,7 +405,7 @@ public final class DefaultCodec implements Codec { ...@@ -405,7 +405,7 @@ public final class DefaultCodec implements Codec {
mediaCodecName, mediaCodecName,
isDecoder isDecoder
? TransformationException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED ? TransformationException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
: TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED); : TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
} }
return TransformationException.createForUnexpected(cause); return TransformationException.createForUnexpected(cause);
} }
......
...@@ -667,7 +667,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory { ...@@ -667,7 +667,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
@RequiresNonNull("#1.sampleMimeType") @RequiresNonNull("#1.sampleMimeType")
private static TransformationException createTransformationException(Format format) { private static TransformationException createTransformationException(Format format) {
return createTransformationException( return createTransformationException(
format, TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED); format, TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
} }
@RequiresNonNull("#1.sampleMimeType") @RequiresNonNull("#1.sampleMimeType")
......
...@@ -66,7 +66,7 @@ public final class TransformationException extends Exception { ...@@ -66,7 +66,7 @@ public final class TransformationException extends Exception {
ERROR_CODE_DECODING_FORMAT_UNSUPPORTED, ERROR_CODE_DECODING_FORMAT_UNSUPPORTED,
ERROR_CODE_ENCODER_INIT_FAILED, ERROR_CODE_ENCODER_INIT_FAILED,
ERROR_CODE_ENCODING_FAILED, ERROR_CODE_ENCODING_FAILED,
ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED, ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED,
ERROR_CODE_HDR_ENCODING_UNSUPPORTED, ERROR_CODE_HDR_ENCODING_UNSUPPORTED,
ERROR_CODE_FRAME_PROCESSING_FAILED, ERROR_CODE_FRAME_PROCESSING_FAILED,
ERROR_CODE_AUDIO_PROCESSING_FAILED, ERROR_CODE_AUDIO_PROCESSING_FAILED,
...@@ -146,12 +146,12 @@ public final class TransformationException extends Exception { ...@@ -146,12 +146,12 @@ public final class TransformationException extends Exception {
/** Caused by a failure while trying to encode media samples. */ /** Caused by a failure while trying to encode media samples. */
public static final int ERROR_CODE_ENCODING_FAILED = 4002; public static final int ERROR_CODE_ENCODING_FAILED = 4002;
/** /**
* Caused by the output format for a track not being supported. * Caused by trying to encode content whose format is not supported. *
* *
* <p>Supported output formats are limited by the muxer's capabilities and the {@linkplain * <p>Supported output formats are limited by the {@linkplain Codec.DecoderFactory encoders}
* Codec.DecoderFactory encoders} available. * available.
*/ */
public static final int ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED = 4003; public static final int ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED = 4003;
/** Caused by the encoder not supporting HDR formats. */ /** Caused by the encoder not supporting HDR formats. */
public static final int ERROR_CODE_HDR_ENCODING_UNSUPPORTED = 4004; public static final int ERROR_CODE_HDR_ENCODING_UNSUPPORTED = 4004;
...@@ -188,7 +188,7 @@ public final class TransformationException extends Exception { ...@@ -188,7 +188,7 @@ public final class TransformationException extends Exception {
.put("ERROR_CODE_HDR_DECODING_UNSUPPORTED", ERROR_CODE_HDR_DECODING_UNSUPPORTED) .put("ERROR_CODE_HDR_DECODING_UNSUPPORTED", ERROR_CODE_HDR_DECODING_UNSUPPORTED)
.put("ERROR_CODE_ENCODER_INIT_FAILED", ERROR_CODE_ENCODER_INIT_FAILED) .put("ERROR_CODE_ENCODER_INIT_FAILED", ERROR_CODE_ENCODER_INIT_FAILED)
.put("ERROR_CODE_ENCODING_FAILED", ERROR_CODE_ENCODING_FAILED) .put("ERROR_CODE_ENCODING_FAILED", ERROR_CODE_ENCODING_FAILED)
.put("ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED", ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED) .put("ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED", ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED)
.put("ERROR_CODE_HDR_ENCODING_UNSUPPORTED", ERROR_CODE_HDR_ENCODING_UNSUPPORTED) .put("ERROR_CODE_HDR_ENCODING_UNSUPPORTED", ERROR_CODE_HDR_ENCODING_UNSUPPORTED)
.put("ERROR_CODE_FRAME_PROCESSING_FAILED", ERROR_CODE_FRAME_PROCESSING_FAILED) .put("ERROR_CODE_FRAME_PROCESSING_FAILED", ERROR_CODE_FRAME_PROCESSING_FAILED)
.put("ERROR_CODE_AUDIO_PROCESSING_FAILED", ERROR_CODE_AUDIO_PROCESSING_FAILED) .put("ERROR_CODE_AUDIO_PROCESSING_FAILED", ERROR_CODE_AUDIO_PROCESSING_FAILED)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
package com.google.android.exoplayer2.transformer; package com.google.android.exoplayer2.transformer;
import static androidx.test.core.app.ApplicationProvider.getApplicationContext; import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
import static com.google.android.exoplayer2.transformer.TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED; import static com.google.android.exoplayer2.transformer.TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertThrows;
...@@ -113,7 +113,7 @@ public class DefaultEncoderFactoryTest { ...@@ -113,7 +113,7 @@ public class DefaultEncoderFactoryTest {
assertThrows( assertThrows(
TransformationException.class, TransformationException.class,
() -> encoderFactory.createForVideoEncoding(requestedVideoFormat)); () -> encoderFactory.createForVideoEncoding(requestedVideoFormat));
assertThat(transformationException.errorCode).isEqualTo(ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED); assertThat(transformationException.errorCode).isEqualTo(ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
} }
@Test @Test
......
...@@ -450,7 +450,7 @@ public final class TransformerEndToEndTest { ...@@ -450,7 +450,7 @@ public final class TransformerEndToEndTest {
assertThat(exception).hasCauseThat().isInstanceOf(IllegalArgumentException.class); assertThat(exception).hasCauseThat().isInstanceOf(IllegalArgumentException.class);
assertThat(exception.errorCode) assertThat(exception.errorCode)
.isEqualTo(TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED); .isEqualTo(TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment