mirror of
https://github.com/androidx/media.git
synced 2025-05-03 21:57:46 +08:00
Allow pause if in offload mode after writing all buffers
In offload mode, `AudioTrack#stop()` will put the track in `PLAYSTATE_STOPPING` rather than `PLAYSTATE_STOPPED`. The difference in state means that `AudioTrack` can be paused and played during this 'stopping' period. Currently, if `AudioTrackPositionTracker#handleEndOfStream()` has been called then `DefaultAudioSink` in `pause()` won't call `AudioTrack#pause()`. `AudioTrack#pause()` should be called in this case if in offload mode. #minor-release PiperOrigin-RevId: 571335108 (cherry picked from commit ab42d64d6d5f1859f1c45aebfe26060978b864bd)
This commit is contained in:
parent
da5a743175
commit
5d0d30a280
@ -1407,7 +1407,8 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
@Override
|
||||
public void pause() {
|
||||
playing = false;
|
||||
if (isAudioTrackInitialized() && audioTrackPositionTracker.pause()) {
|
||||
if (isAudioTrackInitialized()
|
||||
&& (audioTrackPositionTracker.pause() || isOffloadedPlayback(audioTrack))) {
|
||||
audioTrack.pause();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user