Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes liveOffsetTarget override on seek to live edge #11051

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,9 @@ private void seekToInternal(SeekPosition seekPosition) throws ExoPlaybackExcepti
/* newPeriodId= */ periodId,
/* oldTimeline= */ playbackInfo.timeline,
/* oldPeriodId= */ playbackInfo.periodId,
/* positionForTargetOffsetOverrideUs= */ requestedContentPositionUs);
/* positionForTargetOffsetOverrideUs= */ requestedContentPositionUs,
/* positionRequestedBySeek */true);

}
} finally {
playbackInfo =
Expand Down Expand Up @@ -1897,7 +1899,8 @@ timeline, rendererPositionUs, getMaxRendererReadPositionUs())) {
/* oldPeriodId= */ playbackInfo.periodId,
/* positionForTargetOffsetOverrideUs */ positionUpdate.setTargetLiveOffset
? newPositionUs
: C.TIME_UNSET);
: C.TIME_UNSET,
/* positionRequestedBySeek */false);
if (periodPositionChanged
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false every place but the seekToInternal()

|| newRequestedContentPositionUs != playbackInfo.requestedContentPositionUs) {
Object oldPeriodUid = playbackInfo.periodId.periodUid;
Expand Down Expand Up @@ -1935,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 @@ -1965,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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the else side of if (positionForTargetOffsetOverrideUs != C.TIME_UNSET) so we can unconditionally remove the liveOffsetOverride if this is from a seek.

}
}
Expand Down Expand Up @@ -2089,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