Formatting and additional call for preloading period

This commit is contained in:
tonihei 2024-09-27 14:47:21 +01:00
parent 7b0f83690c
commit bf88128383
2 changed files with 15 additions and 11 deletions

View File

@ -2380,7 +2380,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
preloading.prepare(/* callback= */ this, preloading.info.startPositionUs); preloading.prepare(/* callback= */ this, preloading.info.startPositionUs);
} else { } else {
preloading.continueLoading( preloading.continueLoading(
rendererPositionUs, playbackInfo.playbackParameters.speed, lastRebufferRealtimeMs); new LoadingInfo.Builder()
.setPlaybackPositionUs(preloading.toPeriodTime(rendererPositionUs))
.setPlaybackSpeed(mediaClock.getPlaybackParameters().speed)
.setLastRebufferRealtimeMs(lastRebufferRealtimeMs)
.build());
} }
} }
@ -2647,14 +2651,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
private void maybeContinueLoading() { private void maybeContinueLoading() {
shouldContinueLoading = shouldContinueLoading(); shouldContinueLoading = shouldContinueLoading();
if (shouldContinueLoading) { if (shouldContinueLoading) {
LoadingInfo loadingInfo = new LoadingInfo.Builder() MediaPeriodHolder loadingPeriod = checkNotNull(queue.getLoadingPeriod());
.setPlaybackPositionUs(queue.getLoadingPeriod().toPeriodTime(rendererPositionUs)) loadingPeriod.continueLoading(
.setPlaybackSpeed(mediaClock.getPlaybackParameters().speed) new LoadingInfo.Builder()
.setLastRebufferRealtimeMs(lastRebufferRealtimeMs) .setPlaybackPositionUs(loadingPeriod.toPeriodTime(rendererPositionUs))
.build(); .setPlaybackSpeed(mediaClock.getPlaybackParameters().speed)
queue .setLastRebufferRealtimeMs(lastRebufferRealtimeMs)
.getLoadingPeriod() .build());
.continueLoading(loadingInfo);
} }
updateIsLoading(); updateIsLoading();
} }

View File

@ -235,10 +235,11 @@ import java.io.IOException;
} }
/** /**
* Continues loading the media period at the given renderer position. Should only be called if * Continues loading the media period with the given {@link LoadingInfo}. Should only be called if
* this is the loading media period. * this is the loading media period.
* *
* @param loadingInfo The {@link LoadingInfo} when attempting to continue loading. * @param loadingInfo The {@link LoadingInfo} about the current player state relevant to this load
* request.
*/ */
public void continueLoading(LoadingInfo loadingInfo) { public void continueLoading(LoadingInfo loadingInfo) {
checkState(isLoadingMediaPeriod()); checkState(isLoadingMediaPeriod());