Implement DefaultVideoSink.flush()

This is part of the effort to delegate the rendering of the VideoGraph
output frames to a DefaultVideoSink.

PiperOrigin-RevId: 685622019
This commit is contained in:
kimvde 2024-10-14 01:51:16 -07:00 committed by Copybara-Service
parent 7dbacdb011
commit 5eeedeacc6
2 changed files with 4 additions and 4 deletions

View File

@ -80,6 +80,7 @@ import java.util.concurrent.Executor;
if (resetPosition) { if (resetPosition) {
videoFrameReleaseControl.reset(); videoFrameReleaseControl.reset();
} }
videoFrameRenderControl.flush();
} }
@Override @Override

View File

@ -439,12 +439,12 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
videoFrameRenderControl.render(positionUs, elapsedRealtimeUs); videoFrameRenderControl.render(positionUs, elapsedRealtimeUs);
} }
private void flush() { private void flush(boolean resetPosition) {
if (!isInitialized()) { if (!isInitialized()) {
return; return;
} }
pendingFlushCount++; pendingFlushCount++;
videoFrameRenderControl.flush(); defaultVideoSink.flush(resetPosition);
// Handle pending video graph callbacks to ensure video size changes reach the video render // Handle pending video graph callbacks to ensure video size changes reach the video render
// control. // control.
checkStateNotNull(handler).post(() -> pendingFlushCount--); checkStateNotNull(handler).post(() -> pendingFlushCount--);
@ -564,8 +564,7 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
hasRegisteredFirstInputStream = false; hasRegisteredFirstInputStream = false;
finalBufferPresentationTimeUs = C.TIME_UNSET; finalBufferPresentationTimeUs = C.TIME_UNSET;
lastBufferPresentationTimeUs = C.TIME_UNSET; lastBufferPresentationTimeUs = C.TIME_UNSET;
PlaybackVideoGraphWrapper.this.flush(); PlaybackVideoGraphWrapper.this.flush(resetPosition);
defaultVideoSink.flush(resetPosition);
pendingInputStreamBufferPresentationTimeUs = C.TIME_UNSET; pendingInputStreamBufferPresentationTimeUs = C.TIME_UNSET;
// Don't change input stream offset or reset the pending input stream offset change so that // Don't change input stream offset or reset the pending input stream offset change so that
// it's announced with the next input frame. // it's announced with the next input frame.