mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
MediaCodeVideoRenderer: flush video sink before codec
When seeking, we must first flush the video sink so it stops
using any SurfaceTextures before flushing MediaCodec.
#minor-release
PiperOrigin-RevId: 570015998
(cherry picked from commit 144bd72236)
This commit is contained in:
parent
1c7b426ccb
commit
ecfddb9aeb
1 changed files with 3 additions and 1 deletions
|
|
@ -655,10 +655,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer implements Video
|
|||
|
||||
@Override
|
||||
protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||
super.onPositionReset(positionUs, joining);
|
||||
// Flush the video sink first to ensure it stops reading textures that will be owned by
|
||||
// MediaCodec once the codec is flushed.
|
||||
if (videoSink != null) {
|
||||
videoSink.flush();
|
||||
}
|
||||
super.onPositionReset(positionUs, joining);
|
||||
|
||||
if (videoSinkProvider.isInitialized()) {
|
||||
videoSinkProvider.setStreamOffsetUs(getOutputStreamOffsetUs());
|
||||
|
|
|
|||
Loading…
Reference in a new issue