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:
andrewlewis 2018-03-20 02:40:48 -07:00 committed by Oliver Woodman
parent 99959d6130
commit aad5927a2b
2 changed files with 2 additions and 2 deletions

View File

@ -393,8 +393,8 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
@Override
protected void onStopped() {
audioSink.pause();
updateCurrentPosition();
audioSink.pause();
super.onStopped();
}

View File

@ -522,8 +522,8 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
@Override
protected void onStopped() {
audioSink.pause();
updateCurrentPosition();
audioSink.pause();
}
@Override