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
This commit is contained in:
parent
0d12de8134
commit
c37317222c
@ -47,7 +47,7 @@ import androidx.media3.decoder.DecoderInputBuffer;
|
|||||||
/* isDecoder= */ false,
|
/* isDecoder= */ false,
|
||||||
requestedEncoderFormat,
|
requestedEncoderFormat,
|
||||||
/* mediaCodecName= */ null,
|
/* mediaCodecName= */ null,
|
||||||
TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED);
|
TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -407,7 +407,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);
|
||||||
}
|
}
|
||||||
|
@ -669,7 +669,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")
|
||||||
|
@ -68,7 +68,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,
|
||||||
@ -148,12 +148,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;
|
||||||
|
|
||||||
@ -190,7 +190,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)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package androidx.media3.transformer;
|
package androidx.media3.transformer;
|
||||||
|
|
||||||
import static androidx.media3.transformer.TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED;
|
import static androidx.media3.transformer.TransformationException.ERROR_CODE_ENCODING_FORMAT_UNSUPPORTED;
|
||||||
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||||
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 {
|
|||||||
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 {
|
|||||||
|
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user