From 9a45c37158bf99c074c45763f49bdf376ba86faf Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Wed, 3 Apr 2024 09:45:45 -0700 Subject: [PATCH] Cherry pick PR #2672: [media] Reset audio decoder via AudioDecoder::Reset() (#2685) Refer to the original PR: https://github.com/youtube/cobalt/pull/2672 1. When AdaptiveAudioDecoder() resets |audio_decoder_|, use audio_decoder_->Reset() to reset |audio_decoder_|. 2. The PR (https://github.com/youtube/cobalt/pull/2501) does not clean up |resampler_| and |channel_mixer_|, which causes some tests failed on ps5. This PR cleans up |resampler_| and |channel_mixer_| in AdaptiveAudioDecoder::Reset() to fix the SbPlayerGetAudioConfigurationTest.MultipleSeeks test failures. b/327229953 Co-authored-by: Bo-Rong Chen --- .../starboard/player/filter/adaptive_audio_decoder_internal.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc b/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc index 87ba114019b2..0c341ea3e912 100644 --- a/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc +++ b/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc @@ -147,6 +147,8 @@ void AdaptiveAudioDecoder::Reset() { if (audio_decoder_) { audio_decoder_->Reset(); + resampler_.reset(); + channel_mixer_.reset(); } CancelPendingJobs(); while (!decoded_audios_.empty()) {