From 65adcdaeb9c49b86e4f69b22974f0b9e14832ea8 Mon Sep 17 00:00:00 2001 From: samrobinson Date: Tue, 10 Dec 2019 18:29:59 +0000 Subject: [PATCH] Fix an issue where a keyframe was not skipped. Keyframe was rendered rather than skipped when performing an exact seek to a non-zero position close to the start of the stream. PiperOrigin-RevId: 284798460 --- RELEASENOTES.md | 3 +++ .../android/exoplayer2/mediacodec/MediaCodecRenderer.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0f48144cc3..8c3c478a7b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -101,6 +101,9 @@ * Fix Dolby Vision fallback to AVC and HEVC. * Fix early end-of-stream detection when using video tunneling, on API level 23 and above. + * Fix an issue where a keyframe was rendered rather than skipped when + performing an exact seek to a non-zero position close to the start of the + stream. * Audio: * Fix the start of audio getting truncated when transitioning to a new item in a playlist of Opus streams. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java index e5b62a97cc..6f1d005d7d 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java @@ -385,8 +385,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer { @DrainAction private int codecDrainAction; private boolean codecReceivedBuffers; private boolean codecReceivedEos; - private long lastBufferInStreamPresentationTimeUs; private long largestQueuedPresentationTimeUs; + private long lastBufferInStreamPresentationTimeUs; private boolean inputStreamEnded; private boolean outputStreamEnded; private boolean waitingForKeys; @@ -1016,6 +1016,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer { codecReconfigurationState = RECONFIGURATION_STATE_NONE; codecReceivedEos = false; codecReceivedBuffers = false; + largestQueuedPresentationTimeUs = C.TIME_UNSET; + lastBufferInStreamPresentationTimeUs = C.TIME_UNSET; codecDrainState = DRAIN_STATE_NONE; codecDrainAction = DRAIN_ACTION_NONE; codecNeedsAdaptationWorkaroundBuffer = false;