Wrap Choreographer calls to releaseOutputBuffer() in try/catch

This commit is contained in:
Cameron Gutman 2022-05-22 14:32:03 -05:00
parent ac7c5c1064
commit 0a2117241f

View File

@ -432,6 +432,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
// frame of buffer to smooth over network/rendering jitter. // frame of buffer to smooth over network/rendering jitter.
Integer nextOutputBuffer = outputBufferQueue.poll(); Integer nextOutputBuffer = outputBufferQueue.poll();
if (nextOutputBuffer != null) { if (nextOutputBuffer != null) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
videoDecoder.releaseOutputBuffer(nextOutputBuffer, frameTimeNanos); videoDecoder.releaseOutputBuffer(nextOutputBuffer, frameTimeNanos);
} }
@ -441,6 +442,10 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
lastRenderedFrameTimeNanos = frameTimeNanos; lastRenderedFrameTimeNanos = frameTimeNanos;
activeWindowVideoStats.totalFramesRendered++; activeWindowVideoStats.totalFramesRendered++;
} catch (Exception e) {
// This will leak nextOutputBuffer, but there's really nothing else we can do
handleDecoderException(e, null, 0, false);
}
} }
} }