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);
} else {
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() {
shouldContinueLoading = shouldContinueLoading();
if (shouldContinueLoading) {
LoadingInfo loadingInfo = new LoadingInfo.Builder()
.setPlaybackPositionUs(queue.getLoadingPeriod().toPeriodTime(rendererPositionUs))
.setPlaybackSpeed(mediaClock.getPlaybackParameters().speed)
.setLastRebufferRealtimeMs(lastRebufferRealtimeMs)
.build();
queue
.getLoadingPeriod()
.continueLoading(loadingInfo);
MediaPeriodHolder loadingPeriod = checkNotNull(queue.getLoadingPeriod());
loadingPeriod.continueLoading(
new LoadingInfo.Builder()
.setPlaybackPositionUs(loadingPeriod.toPeriodTime(rendererPositionUs))
.setPlaybackSpeed(mediaClock.getPlaybackParameters().speed)
.setLastRebufferRealtimeMs(lastRebufferRealtimeMs)
.build());
}
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.
*
* @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) {
checkState(isLoadingMediaPeriod());