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 8fbc2a5c9b
commit 022b85a625
2 changed files with 5 additions and 3 deletions

View file

@ -11,6 +11,8 @@
* DefaultTrackSelector: Support undefined language text track selection when the
preferred language is not available
([#2980](https://github.com/google/ExoPlayer/issues/2980)).
* 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) {