Commit aad5927a by andrewlewis Committed by Oliver Woodman

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
parent 99959d61
......@@ -393,8 +393,8 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
@Override
protected void onStopped() {
audioSink.pause();
updateCurrentPosition();
audioSink.pause();
super.onStopped();
}
......
......@@ -522,8 +522,8 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
@Override
protected void onStopped() {
audioSink.pause();
updateCurrentPosition();
audioSink.pause();
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment