mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Update audio renderer position before pausing
As part of pausing DefaultAudioSink, its position-related fields are reset. If the audio timestamp API was in use, this results in falling back to the getPlaybackHeadPosition API, which (on some devices) can lead to a jump in the reported position. Sample the position before pausing instead of after, to avoid this jump. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=189713376
This commit is contained in:
parent
99959d6130
commit
aad5927a2b
@ -393,8 +393,8 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStopped() {
|
protected void onStopped() {
|
||||||
audioSink.pause();
|
|
||||||
updateCurrentPosition();
|
updateCurrentPosition();
|
||||||
|
audioSink.pause();
|
||||||
super.onStopped();
|
super.onStopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,8 +522,8 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStopped() {
|
protected void onStopped() {
|
||||||
audioSink.pause();
|
|
||||||
updateCurrentPosition();
|
updateCurrentPosition();
|
||||||
|
audioSink.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user