Render the latest frame available at the time

This commit is contained in:
Cameron Gutman 2014-02-19 19:40:35 -05:00
parent 839540dc74
commit c537af2273

View File

@ -133,8 +133,18 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
default:
break;
}
if (outIndex >= 0) {
videoDecoder.releaseOutputBuffer(outIndex, true);
int lastIndex = outIndex;
// Get the last output buffer in the queue
while ((outIndex = videoDecoder.dequeueOutputBuffer(info, 0)) >= 0) {
videoDecoder.releaseOutputBuffer(lastIndex, false);
lastIndex = outIndex;
}
// Render that buffer
videoDecoder.releaseOutputBuffer(lastIndex, true);
}
}
}