mirror of
https://github.com/androidx/media.git
synced 2025-04-29 22:36:54 +08:00
Merge pull request #1651 from colinkho:mp-cl
PiperOrigin-RevId: 683548885
This commit is contained in:
commit
62864d5475
@ -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,10 +2651,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
private void maybeContinueLoading() {
|
||||
shouldContinueLoading = shouldContinueLoading();
|
||||
if (shouldContinueLoading) {
|
||||
queue
|
||||
.getLoadingPeriod()
|
||||
.continueLoading(
|
||||
rendererPositionUs, mediaClock.getPlaybackParameters().speed, lastRebufferRealtimeMs);
|
||||
MediaPeriodHolder loadingPeriod = checkNotNull(queue.getLoadingPeriod());
|
||||
loadingPeriod.continueLoading(
|
||||
new LoadingInfo.Builder()
|
||||
.setPlaybackPositionUs(loadingPeriod.toPeriodTime(rendererPositionUs))
|
||||
.setPlaybackSpeed(mediaClock.getPlaybackParameters().speed)
|
||||
.setLastRebufferRealtimeMs(lastRebufferRealtimeMs)
|
||||
.build());
|
||||
}
|
||||
updateIsLoading();
|
||||
}
|
||||
|
@ -235,25 +235,15 @@ 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 rendererPositionUs The load position in renderer time, in microseconds.
|
||||
* @param playbackSpeed The playback speed indicating the current rate of playback.
|
||||
* @param lastRebufferRealtimeMs The time at which the last rebuffering occurred, in milliseconds
|
||||
* since boot including time spent in sleep. The time base used is the same as that measured
|
||||
* by {@link android.os.SystemClock#elapsedRealtime}.
|
||||
* @param loadingInfo The {@link LoadingInfo} about the current player state relevant to this load
|
||||
* request.
|
||||
*/
|
||||
public void continueLoading(
|
||||
long rendererPositionUs, float playbackSpeed, long lastRebufferRealtimeMs) {
|
||||
public void continueLoading(LoadingInfo loadingInfo) {
|
||||
checkState(isLoadingMediaPeriod());
|
||||
long loadingPeriodPositionUs = toPeriodTime(rendererPositionUs);
|
||||
mediaPeriod.continueLoading(
|
||||
new LoadingInfo.Builder()
|
||||
.setPlaybackPositionUs(loadingPeriodPositionUs)
|
||||
.setPlaybackSpeed(playbackSpeed)
|
||||
.setLastRebufferRealtimeMs(lastRebufferRealtimeMs)
|
||||
.build());
|
||||
mediaPeriod.continueLoading(loadingInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user