Skip to content

Commit

Permalink
Update the change to fix Removes liveOffsetTarget
Browse files Browse the repository at this point in the history
Will squash this with the first commit and update the message with
the actual change.  This is a seperate commit just to track in the
pull request
  • Loading branch information
stevemayhew committed Mar 17, 2023
1 parent e27018e commit 31b6166
Showing 1 changed file with 16 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1243,29 +1243,14 @@ private void seekToInternal(SeekPosition seekPosition) throws ExoPlaybackExcepti
/* forceBufferingState= */ playbackInfo.playbackState == Player.STATE_ENDED);
seekPositionAdjusted |= periodPositionUs != newPeriodPositionUs;
periodPositionUs = newPeriodPositionUs;
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);
updatePlaybackSpeedSettingsForNewPeriod(
/* newTimeline= */ playbackInfo.timeline,
/* newPeriodId= */ periodId,
/* oldTimeline= */ playbackInfo.timeline,
/* oldPeriodId= */ playbackInfo.periodId,
/* positionForTargetOffsetOverrideUs= */ requestedContentPositionUs,
/* positionRequestedBySeek */true);

}
}
} finally {
playbackInfo =
Expand Down Expand Up @@ -1914,7 +1899,8 @@ timeline, rendererPositionUs, getMaxRendererReadPositionUs())) {
/* oldPeriodId= */ playbackInfo.periodId,
/* positionForTargetOffsetOverrideUs */ positionUpdate.setTargetLiveOffset
? newPositionUs
: C.TIME_UNSET);
: C.TIME_UNSET,
/* positionRequestedBySeek */false);
if (periodPositionChanged
|| newRequestedContentPositionUs != playbackInfo.requestedContentPositionUs) {
Object oldPeriodUid = playbackInfo.periodId.periodUid;
Expand Down Expand Up @@ -1952,7 +1938,8 @@ private void updatePlaybackSpeedSettingsForNewPeriod(
MediaPeriodId newPeriodId,
Timeline oldTimeline,
MediaPeriodId oldPeriodId,
long positionForTargetOffsetOverrideUs)
long positionForTargetOffsetOverrideUs,
boolean positionRequestedBySeek)
throws ExoPlaybackException {
if (!shouldUseLivePlaybackSpeedControl(newTimeline, newPeriodId)) {
// Live playback speed control is unused for the current period, reset speed to user-defined
Expand Down Expand Up @@ -1982,8 +1969,9 @@ private void updatePlaybackSpeedSettingsForNewPeriod(
int oldWindowIndex = oldTimeline.getPeriodByUid(oldPeriodId.periodUid, period).windowIndex;
oldWindowUid = oldTimeline.getWindow(oldWindowIndex, window).uid;
}
if (!Util.areEqual(oldWindowUid, windowUid)) {
// Reset overridden target live offset to media values if window changes.
if (!Util.areEqual(oldWindowUid, windowUid) || positionRequestedBySeek) {
// Reset overridden target live offset to media values if window changes or if seekTo
// default live position.
livePlaybackSpeedControl.setTargetLiveOffsetOverrideUs(C.TIME_UNSET);
}
}
Expand Down Expand Up @@ -2106,7 +2094,8 @@ private void maybeUpdateReadingPeriod() throws ExoPlaybackException {
/* newPeriodId= */ readingPeriodHolder.info.id,
/* oldTimeline= */ playbackInfo.timeline,
/* oldPeriodId= */ oldReadingPeriodHolder.info.id,
/* positionForTargetOffsetOverrideUs= */ C.TIME_UNSET);
/* positionForTargetOffsetOverrideUs= */ C.TIME_UNSET,
/* positionRequestedBySeek */false);

if (readingPeriodHolder.prepared
&& readingPeriodHolder.mediaPeriod.readDiscontinuity() != C.TIME_UNSET) {
Expand Down

0 comments on commit 31b6166

Please sign in to comment.