mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Limit dynamic scheduling by the playing period transition point
In the case of replace stream media item transition, it is important that dynamic scheduling does not set the next work task later than the transition boundary. #cherrypick PiperOrigin-RevId: 723502204
This commit is contained in:
parent
85158ec841
commit
edc44eefd2
@ -1377,6 +1377,16 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
rendererHolder.getMinDurationToProgressUs(
|
||||
rendererPositionUs, rendererPositionElapsedRealtimeUs)));
|
||||
}
|
||||
|
||||
// Do not schedule next doSomeWork past the playing period transition point.
|
||||
MediaPeriodHolder nextPlayingPeriodHolder =
|
||||
queue.getPlayingPeriod() != null ? queue.getPlayingPeriod().getNext() : null;
|
||||
if (nextPlayingPeriodHolder != null
|
||||
&& rendererPositionUs
|
||||
+ msToUs(wakeUpTimeIntervalMs) * playbackInfo.playbackParameters.speed
|
||||
>= nextPlayingPeriodHolder.getStartPositionRendererTime()) {
|
||||
wakeUpTimeIntervalMs = min(wakeUpTimeIntervalMs, BUFFERING_MAXIMUM_INTERVAL_MS);
|
||||
}
|
||||
}
|
||||
handler.sendEmptyMessageAtTime(
|
||||
MSG_DO_SOME_WORK, thisOperationStartTimeMs + wakeUpTimeIntervalMs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user