From 28feba6a6cff21ba5dbddd1ee7882012217c91cf Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Tue, 21 Jun 2022 09:34:44 -0300 Subject: [PATCH] Add proper catch for ISE in video thumb extractor. --- .../video/videoconverter/VideoThumbnailsExtractor.java | 9 ++++++++- .../video/videoconverter/TranscodingException.java | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/video/videoconverter/VideoThumbnailsExtractor.java b/app/src/main/java/org/thoughtcrime/securesms/video/videoconverter/VideoThumbnailsExtractor.java index 370d295b3..512f50fe5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/video/videoconverter/VideoThumbnailsExtractor.java +++ b/app/src/main/java/org/thoughtcrime/securesms/video/videoconverter/VideoThumbnailsExtractor.java @@ -161,7 +161,14 @@ final class VideoThumbnailsExtractor { } } - int outputBufIndex = decoder.dequeueOutputBuffer(info, TIMEOUT_USEC); + final int outputBufIndex; + try { + outputBufIndex = decoder.dequeueOutputBuffer(info, TIMEOUT_USEC); + } catch (IllegalStateException e) { + Log.w(TAG, "Decoder not in the Executing state, or codec is configured in asynchronous mode.", e); + throw new TranscodingException("Decoder not in the Executing state, or codec is configured in asynchronous mode.", e); + } + if (outputBufIndex >= 0) { if ((info.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) { outputDone = true; diff --git a/video/src/main/java/org/thoughtcrime/securesms/video/videoconverter/TranscodingException.java b/video/src/main/java/org/thoughtcrime/securesms/video/videoconverter/TranscodingException.java index eb9d4c133..b0ea65a21 100644 --- a/video/src/main/java/org/thoughtcrime/securesms/video/videoconverter/TranscodingException.java +++ b/video/src/main/java/org/thoughtcrime/securesms/video/videoconverter/TranscodingException.java @@ -9,4 +9,8 @@ final class TranscodingException extends Exception { TranscodingException(Throwable inner) { super(inner); } + + TranscodingException(String message, Throwable inner) { + super(message, inner); + } }