Flush FrameProcessor when appropriate.

PiperOrigin-RevId: 507461550
This commit is contained in:
claincly 2023-02-06 14:20:56 +00:00 committed by microkatz
parent afa3c628c1
commit f630315af5

View file

@ -1178,9 +1178,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
if (frameProcessorManager.isEnabled()) {
notifyFrameMetaDataListener = false;
if (!frameProcessorManager.maybeRegisterFrame(format, presentationTimeUs, isLastBuffer)) {
// TODO(b/238302341): Handle FrameProcessor is unable to accept the force rendered buffer.
// Treat the frame as dropped for now.
return true;
return false;
}
} else {
notifyFrameMetaDataListener = true;
@ -1454,6 +1452,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
droppedSourceBufferCount, /* droppedDecoderBufferCount= */ buffersInCodecCount);
}
flushOrReinitializeCodec();
if (frameProcessorManager.isEnabled()) {
frameProcessorManager.flush();
}
return true;
}