From 98e9022c0ef10eba6d92e85396da6364fbe3b4c8 Mon Sep 17 00:00:00 2001 From: claincly Date: Mon, 6 Nov 2023 02:42:10 -0800 Subject: [PATCH] Ensure the exception thrown in the constructor is reported PiperOrigin-RevId: 579776559 --- .../java/androidx/media3/effect/FrameDropTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/effect/src/androidTest/java/androidx/media3/effect/FrameDropTest.java b/libraries/effect/src/androidTest/java/androidx/media3/effect/FrameDropTest.java index 47466d8bfe..93f8ff7640 100644 --- a/libraries/effect/src/androidTest/java/androidx/media3/effect/FrameDropTest.java +++ b/libraries/effect/src/androidTest/java/androidx/media3/effect/FrameDropTest.java @@ -196,6 +196,7 @@ public class FrameDropTest { @Override public void onError(VideoFrameProcessingException exception) { videoFrameProcessingExceptionReference.set(exception); + videoFrameProcessorReadyCountDownLatch.countDown(); videoFrameProcessingEndedCountDownLatch.countDown(); } @@ -242,14 +243,22 @@ public class FrameDropTest { frameDropEffect), new FrameInfo.Builder(BLANK_FRAME_WIDTH, BLANK_FRAME_HEIGHT).build()); videoFrameProcessorReadyCountDownLatch.await(); + checkNoVideoFrameProcessingExceptionIsThrown(videoFrameProcessingExceptionReference); blankFrameProducer.produceBlankFrames(inputPresentationTimesUs); defaultVideoFrameProcessor.signalEndOfInput(); videoFrameProcessingEndedCountDownLatch.await(); + checkNoVideoFrameProcessingExceptionIsThrown(videoFrameProcessingExceptionReference); + return actualPresentationTimesUs.build(); + } + + private static void checkNoVideoFrameProcessingExceptionIsThrown( + AtomicReference<@NullableType VideoFrameProcessingException> + videoFrameProcessingExceptionReference) + throws Exception { @Nullable Exception videoFrameProcessingException = videoFrameProcessingExceptionReference.get(); if (videoFrameProcessingException != null) { throw videoFrameProcessingException; } - return actualPresentationTimesUs.build(); } }