Call VideoFrameReleaseControl.join from VideoSink when enabled
PiperOrigin-RevId: 644738200
This commit is contained in:
parent
ff4feed0eb
commit
4751b80703
@ -788,6 +788,11 @@ public final class CompositingVideoSinkProvider implements VideoSinkProvider, Vi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void join(boolean renderNextFrameImmediately) {
|
||||
videoFrameReleaseControl.join(renderNextFrameImmediately);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
CompositingVideoSinkProvider.this.release();
|
||||
|
@ -731,7 +731,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
// Don't render next frame immediately to let the codec catch up with the playback position
|
||||
// first. This prevents a stuttering effect caused by showing the first frame and then
|
||||
// dropping many of the subsequent frames during the catch up phase.
|
||||
videoFrameReleaseControl.join(/* renderNextFrameImmediately= */ false);
|
||||
if (videoSink != null) {
|
||||
videoSink.join(/* renderNextFrameImmediately= */ false);
|
||||
} else {
|
||||
videoFrameReleaseControl.join(/* renderNextFrameImmediately= */ false);
|
||||
}
|
||||
}
|
||||
maybeSetupTunnelingForFirstFrame();
|
||||
consecutiveDroppedFrameCount = 0;
|
||||
@ -924,7 +928,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
|
||||
// before we rendered the new first frame. Since there is no reason to believe the next
|
||||
// frame is delayed and the renderer needs to catch up, we still request to render the
|
||||
// next frame as soon as possible.
|
||||
videoFrameReleaseControl.join(/* renderNextFrameImmediately= */ true);
|
||||
if (videoSink != null) {
|
||||
videoSink.join(/* renderNextFrameImmediately= */ true);
|
||||
} else {
|
||||
videoFrameReleaseControl.join(/* renderNextFrameImmediately= */ true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// The display surface has been removed.
|
||||
|
@ -302,7 +302,7 @@ public final class VideoFrameReleaseControl {
|
||||
/**
|
||||
* Joins the release control to a new stream.
|
||||
*
|
||||
* <p>The release control will pretend to be {@linkplain #isReady ready} for short time even if
|
||||
* <p>The release control will pretend to be {@linkplain #isReady ready} for a short time even if
|
||||
* the first frame hasn't been rendered yet to avoid interrupting an ongoing playback.
|
||||
*
|
||||
* @param renderNextFrameImmediately Whether the next frame should be released as soon as possible
|
||||
|
@ -265,6 +265,17 @@ public interface VideoSink {
|
||||
*/
|
||||
void render(long positionUs, long elapsedRealtimeUs) throws VideoSinkException;
|
||||
|
||||
/**
|
||||
* Joins the video sink to a new stream.
|
||||
*
|
||||
* <p>The sink will pretend to be {@linkplain #isReady ready} for a short time even if the first
|
||||
* frame hasn't been rendered yet to avoid interrupting an ongoing playback.
|
||||
*
|
||||
* @param renderNextFrameImmediately Whether the next frame should be rendered as soon as possible
|
||||
* or only at its preferred scheduled release time.
|
||||
*/
|
||||
void join(boolean renderNextFrameImmediately);
|
||||
|
||||
/** Releases the sink. */
|
||||
void release();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user