Skip to content

Commit

Permalink
TrackSelection does not arbitrarily jumb to live
Browse files Browse the repository at this point in the history
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).

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Thu Sep 2 11:30:31 2021 -0700
#
# On branch p-fix-exo-issue-9347
# Changes to be committed:
#	modified:   library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaPeriod.java
#	modified:   library/core/src/main/java/com/google/android/exoplayer2/source/MaskingMediaSource.java
#
# Untracked files:
#	validation_data.json
#
  • Loading branch information
stevemayhew committed Sep 3, 2021
1 parent 373db56 commit 949037c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,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
Expand Down

0 comments on commit 949037c

Please sign in to comment.