From 2564a121dc0c66bc78946163870eaa2e632c68ca Mon Sep 17 00:00:00 2001 From: tonihei Date: Tue, 21 Jan 2020 16:34:24 +0000 Subject: [PATCH] Remove pointless use of playbackInfo.startPositionUs We have a flag that gets turned on if the current playback position has been reset, so that messages from this reset position can be triggered. This mechanism isn't actually depending on the startPositionUs field because it should always be triggered in the first iteration with the new position. PiperOrigin-RevId: 290749201 --- .../google/android/exoplayer2/ExoPlayerImplInternal.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java index 32d6e2251e..176f6d745a 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java @@ -1318,13 +1318,12 @@ import java.util.concurrent.atomic.AtomicBoolean; if (pendingMessages.isEmpty() || playbackInfo.periodId.isAd()) { return; } - // If this is the first call from the start position, include oldPeriodPositionUs in potential - // trigger positions, but make sure we deliver it only once. - if (playbackInfo.startPositionUs == oldPeriodPositionUs - && deliverPendingMessageAtStartPositionRequired) { + // If this is the first call after resetting the renderer position, include oldPeriodPositionUs + // in potential trigger positions, but make sure we deliver it only once. + if (deliverPendingMessageAtStartPositionRequired) { oldPeriodPositionUs--; + deliverPendingMessageAtStartPositionRequired = false; } - deliverPendingMessageAtStartPositionRequired = false; // Correct next index if necessary (e.g. after seeking, timeline changes, or new messages) int currentPeriodIndex =