Skip to content

Commit

Permalink
Removes liveOffsetTarget override on seek to live edge
Browse files Browse the repository at this point in the history
Any calls that issue a `seekTo()` where the position is `TIME_UNSET` will
now restore the live offset target to the MediaItem set default.

The code handles an intra-period seek in the same timeline by simply updating or removing
the `setTargetLiveOffsetOverrideUs()`.  Other cases call the original code.

This fixes issue google#11050
  • Loading branch information
stevemayhew committed Mar 17, 2023
1 parent d88dd74 commit e27018e
Showing 1 changed file with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1243,12 +1243,29 @@ private void seekToInternal(SeekPosition seekPosition) throws ExoPlaybackExcepti
/* forceBufferingState= */ playbackInfo.playbackState == Player.STATE_ENDED);
seekPositionAdjusted |= periodPositionUs != newPeriodPositionUs;
periodPositionUs = newPeriodPositionUs;
updatePlaybackSpeedSettingsForNewPeriod(
/* newTimeline= */ playbackInfo.timeline,
/* newPeriodId= */ periodId,
/* oldTimeline= */ playbackInfo.timeline,
/* oldPeriodId= */ playbackInfo.periodId,
/* positionForTargetOffsetOverrideUs= */ requestedContentPositionUs);
if (periodId.equals(playbackInfo.periodId)) {
if (shouldUseLivePlaybackSpeedControl(playbackInfo.timeline, periodId)) {
int windowIndex = playbackInfo.timeline.getPeriodByUid(periodId.periodUid, period).windowIndex;
playbackInfo.timeline.getWindow(windowIndex, window);
if (requestedContentPositionUs != C.TIME_UNSET) {
livePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(
getLiveOffsetUs(playbackInfo.timeline, periodId.periodUid, requestedContentPositionUs));
} else {
if (!playbackInfo.timeline.isEmpty()) {
// Seek resolved to window.getDefaultPositionMs(), so just remove the override.
livePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(C.TIME_UNSET);
}
}
}
} else {
updatePlaybackSpeedSettingsForNewPeriod(
/* newTimeline= */ playbackInfo.timeline,
/* newPeriodId= */ periodId,
/* oldTimeline= */ playbackInfo.timeline,
/* oldPeriodId= */ playbackInfo.periodId,
/* positionForTargetOffsetOverrideUs= */ requestedContentPositionUs);

}
}
} finally {
playbackInfo =
Expand Down

0 comments on commit e27018e

Please sign in to comment.