Move resetting audio processors to initialize()

The set of active audio processors was only updated on reconfiguration and when
draining playback parameters completed. Draining playback parameters are cleared
in reset(), so if parameters were set while paused then the sink was quickly
reset, without draining completing, the set of active audio processors wouldn't
be updated. This means that a switch to or from speed or pitch = 1 would not be
handled correctly if made while paused and followed by a seek.

Move resetting active audio processors from configure (where if the active audio
processors were reset we'd always initialize a new AudioTrack) to initialize().

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177442098
This commit is contained in:
andrewlewis 2017-11-30 05:39:50 -08:00 committed by Oliver Woodman
parent cc54d4d3e6
commit 7b08899818
2 changed files with 5 additions and 3 deletions

View file

@ -25,6 +25,8 @@
preferred language is not available
([#2980](https://github.com/google/ExoPlayer/issues/2980)).
* Add optional parameter to `Player.stop` to reset the player when stopping.
* Fix handling of playback parameters changes while paused when followed by a
seek.
### 2.6.0 ###

View file

@ -364,9 +364,6 @@ public final class DefaultAudioSink implements AudioSink {
encoding = audioProcessor.getOutputEncoding();
}
}
if (flush) {
resetAudioProcessors();
}
}
int channelConfig;
@ -492,6 +489,9 @@ public final class DefaultAudioSink implements AudioSink {
// The old playback parameters may no longer be applicable so try to reset them now.
setPlaybackParameters(playbackParameters);
// Flush and reset active audio processors.
resetAudioProcessors();
int audioSessionId = audioTrack.getAudioSessionId();
if (enablePreV21AudioSessionWorkaround) {
if (Util.SDK_INT < 21) {