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,15 +432,20 @@ 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) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { try {
videoDecoder.releaseOutputBuffer(nextOutputBuffer, frameTimeNanos); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
} videoDecoder.releaseOutputBuffer(nextOutputBuffer, frameTimeNanos);
else { }
videoDecoder.releaseOutputBuffer(nextOutputBuffer, true); else {
} videoDecoder.releaseOutputBuffer(nextOutputBuffer, true);
}
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);
}
} }
} }