Commit 26fdb3e0 by kimvde Committed by Tianyi Feng

Add error code for muxer timeout

PiperOrigin-RevId: 519965132
parent 782f19ed
...@@ -67,6 +67,7 @@ public final class ExportException extends Exception { ...@@ -67,6 +67,7 @@ public final class ExportException extends Exception {
ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED, ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED,
ERROR_CODE_AUDIO_PROCESSING_FAILED, ERROR_CODE_AUDIO_PROCESSING_FAILED,
ERROR_CODE_MUXING_FAILED, ERROR_CODE_MUXING_FAILED,
ERROR_CODE_MUXING_TIMEOUT,
}) })
public @interface ErrorCode {} public @interface ErrorCode {}
...@@ -161,6 +162,12 @@ public final class ExportException extends Exception { ...@@ -161,6 +162,12 @@ public final class ExportException extends Exception {
/** Caused by a failure while muxing media samples. */ /** Caused by a failure while muxing media samples. */
public static final int ERROR_CODE_MUXING_FAILED = 7001; public static final int ERROR_CODE_MUXING_FAILED = 7001;
/**
* Caused by a timeout while muxing media samples.
*
* @see Muxer#getMaxDelayBetweenSamplesMs()
*/
public static final int ERROR_CODE_MUXING_TIMEOUT = 7002;
/* package */ static final ImmutableBiMap<String, @ErrorCode Integer> NAME_TO_ERROR_CODE = /* package */ static final ImmutableBiMap<String, @ErrorCode Integer> NAME_TO_ERROR_CODE =
new ImmutableBiMap.Builder<String, @ErrorCode Integer>() new ImmutableBiMap.Builder<String, @ErrorCode Integer>()
...@@ -183,6 +190,7 @@ public final class ExportException extends Exception { ...@@ -183,6 +190,7 @@ public final class ExportException extends Exception {
.put("ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED", ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED) .put("ERROR_CODE_VIDEO_FRAME_PROCESSING_FAILED", ERROR_CODE_VIDEO_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)
.put("ERROR_CODE_MUXING_FAILED", ERROR_CODE_MUXING_FAILED) .put("ERROR_CODE_MUXING_FAILED", ERROR_CODE_MUXING_FAILED)
.put("ERROR_CODE_MUXING_TIMEOUT", ERROR_CODE_MUXING_TIMEOUT)
.buildOrThrow(); .buildOrThrow();
/** Returns the name of a given {@code errorCode}. */ /** Returns the name of a given {@code errorCode}. */
......
...@@ -301,7 +301,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -301,7 +301,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
"No output sample written in the last " "No output sample written in the last "
+ maxDelayBetweenSamplesMs + maxDelayBetweenSamplesMs
+ " milliseconds. Aborting transformation."), + " milliseconds. Aborting transformation."),
ExportException.ERROR_CODE_MUXING_FAILED)); ExportException.ERROR_CODE_MUXING_TIMEOUT));
}, },
maxDelayBetweenSamplesMs, maxDelayBetweenSamplesMs,
MILLISECONDS); MILLISECONDS);
......
...@@ -821,7 +821,7 @@ public final class MediaItemExportTest { ...@@ -821,7 +821,7 @@ public final class MediaItemExportTest {
ExportException exception = ExportException exception =
assertThrows(ExportException.class, () -> TransformerTestRunner.runLooper(transformer)); assertThrows(ExportException.class, () -> TransformerTestRunner.runLooper(transformer));
assertThat(exception).hasCauseThat().isInstanceOf(IllegalStateException.class); assertThat(exception).hasCauseThat().isInstanceOf(IllegalStateException.class);
assertThat(exception.errorCode).isEqualTo(ExportException.ERROR_CODE_MUXING_FAILED); assertThat(exception.errorCode).isEqualTo(ExportException.ERROR_CODE_MUXING_TIMEOUT);
} }
@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