Skip to content

Commit 2f8779b

Browse files
committedSep 7, 2021
TrackSelection does not jump to live with HlsMediaPeriod
This is a fix for issue google#9347 Once the MaskingMediaPeriod completes `prepare()` (when the masked HlsMediaPeriod reports the first real Timeline with a duration and window start position) and the `preparePositionUs` is used by the player in the `onPrepared()` callback to set the render 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).
1 parent 7129d84 commit 2f8779b

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed
 

‎library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaPeriod.java

-4
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ public long selectTracks(
178178
@NullableType SampleStream[] streams,
179179
boolean[] streamResetFlags,
180180
long positionUs) {
181-
if (preparePositionOverrideUs != C.TIME_UNSET && positionUs == preparePositionUs) {
182-
positionUs = preparePositionOverrideUs;
183-
preparePositionOverrideUs = C.TIME_UNSET;
184-
}
185181
return castNonNull(mediaPeriod)
186182
.selectTracks(selections, mayRetainStreamFlags, streams, streamResetFlags, positionUs);
187183
}

‎library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaSource.java

-5
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ protected void onChildSourceInfoRefreshed(
140140
@Nullable MediaPeriodId idForMaskingPeriodPreparation = null;
141141
if (isPrepared) {
142142
timeline = timeline.cloneWithUpdatedTimeline(newTimeline);
143-
if (unpreparedMaskingMediaPeriod != null) {
144-
// Reset override in case the duration changed and we need to update our override.
145-
setPreparePositionOverrideToUnpreparedMaskingPeriod(
146-
unpreparedMaskingMediaPeriod.getPreparePositionOverrideUs());
147-
}
148143
} else if (newTimeline.isEmpty()) {
149144
timeline =
150145
hasRealTimeline

0 commit comments

Comments
 (0)