mirror of
https://github.com/samsonjs/media.git
synced 2026-04-01 10:35:48 +00:00
Disable offload scheduling at set up for track transition
While sleeping for offload, position is estimated based on time playing. If asleep and AudioTrack is reused, then the position will keep incrementing as the subsequent item plays. That is until wakeup when playing position is updated to the timestamp of the second item. Offload scheduling should be disabled until track transitions fully.
PiperOrigin-RevId: 570397140
(cherry picked from commit da06bf057a)
This commit is contained in:
parent
e4637d82b7
commit
2564c11834
1 changed files with 5 additions and 0 deletions
|
|
@ -2251,6 +2251,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
readingPeriodHolder.getStartPositionRendererTime(),
|
||||
readingPeriodHolder.getRendererOffset(),
|
||||
readingPeriodHolder.info.id);
|
||||
if (offloadSchedulingEnabled) {
|
||||
// Prevent sleeping across offload track transition else position won't get updated.
|
||||
// TODO: (b/183635183) Optimize Offload End-Of-Stream: Sleep to just before end of track
|
||||
setOffloadSchedulingEnabled(false);
|
||||
}
|
||||
} else if (renderer.isEnded()) {
|
||||
// The renderer has finished playback, so we can disable it now.
|
||||
disableRenderer(renderer);
|
||||
|
|
|
|||
Loading…
Reference in a new issue