Don't try to track buffersInCodec with tunneling

PiperOrigin-RevId: 283551324
This commit is contained in:
andrewlewis 2019-12-03 16:34:24 +00:00 committed by bachinger
parent 6c10c94f94
commit 21dd59badb

View file

@ -763,7 +763,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
@CallSuper
@Override
protected void onQueueInputBuffer(DecoderInputBuffer buffer) {
buffersInCodecCount++;
// In tunneling mode the device may do frame rate conversion, so in general we can't keep track
// of the number of buffers in the codec.
if (!tunneling) {
buffersInCodecCount++;
}
lastInputTimeUs = Math.max(buffer.timeUs, lastInputTimeUs);
if (Util.SDK_INT < 23 && tunneling) {
// In tunneled mode before API 23 we don't have a way to know when the buffer is output, so
@ -1008,7 +1012,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
@CallSuper
@Override
protected void onProcessedOutputBuffer(long presentationTimeUs) {
buffersInCodecCount--;
if (!tunneling) {
buffersInCodecCount--;
}
while (pendingOutputStreamOffsetCount != 0
&& presentationTimeUs >= pendingOutputStreamSwitchTimesUs[0]) {
outputStreamOffsetUs = pendingOutputStreamOffsetsUs[0];