From 022b85a625468235075de679cc19374fca823d8a Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Thu, 30 Nov 2017 05:39:50 -0800 Subject: [PATCH] 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 --- RELEASENOTES.md | 2 ++ .../google/android/exoplayer2/audio/DefaultAudioSink.java | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index ae5bc0fb95..a123c78323 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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 ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java index ba62ac126e..eb27c0fe55 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java @@ -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) {