From 109232e5b416a9a2d9c90f762142b4bc5aa33536 Mon Sep 17 00:00:00 2001 From: Steve Mayhew Date: Thu, 2 Sep 2021 14:16:08 -0700 Subject: [PATCH] Fix for google issue #9347 and our WSIPCL11050 (#170) Once the MaskingMediaPeriod completes `prepare()` (when the masked HlsMediaPeriod reports the first real Timeline with a duration and window start position) it should not use it again. The bug is a track selection causes a jump to live if you are at position 0 in the timeline, even after playback was started from the live point (the prepare position override). --- .../google/android/exoplayer2/source/MaskingMediaPeriod.java | 4 ---- .../google/android/exoplayer2/source/MaskingMediaSource.java | 5 ----- 2 files changed, 9 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaPeriod.java b/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaPeriod.java index a69835532f4..5f2ddb3927c 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaPeriod.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaPeriod.java @@ -178,10 +178,6 @@ public long selectTracks( @NullableType SampleStream[] streams, boolean[] streamResetFlags, long positionUs) { - if (preparePositionOverrideUs != C.TIME_UNSET && positionUs == preparePositionUs) { - positionUs = preparePositionOverrideUs; - preparePositionOverrideUs = C.TIME_UNSET; - } return castNonNull(mediaPeriod) .selectTracks(selections, mayRetainStreamFlags, streams, streamResetFlags, positionUs); } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaSource.java b/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaSource.java index 5d2e1c6fb7b..82c382af2a6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaSource.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaSource.java @@ -150,11 +150,6 @@ protected void onChildSourceInfoRefreshed( @Nullable MediaPeriodId idForMaskingPeriodPreparation = null; if (isPrepared) { timeline = timeline.cloneWithUpdatedTimeline(newTimeline); - if (unpreparedMaskingMediaPeriod != null) { - // Reset override in case the duration changed and we need to update our override. - setPreparePositionOverrideToUnpreparedMaskingPeriod( - unpreparedMaskingMediaPeriod.getPreparePositionOverrideUs()); - } } else if (newTimeline.isEmpty()) { timeline = hasRealTimeline