Avoid recreating the audio stream when a frame decryptor is set. This is to be consistent with how things work on the video side but also much less drastic than the current implementation. Aim is to remove RecreateAudioReceiveStream(), which would improve efficiency as well as allow for specific handling of the cases that currently trigger recreation. Bug: webrtc:11993 Change-Id: Ia81a5e66d44e41ea4eb2bff800e0b1583821c96a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221860 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Markus Handell <handellm@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34282}
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc index cc53a74..7476e08 100644 --- a/audio/audio_receive_stream.cc +++ b/audio/audio_receive_stream.cc
@@ -246,6 +246,14 @@ } } +void AudioReceiveStream::SetFrameDecryptor( + rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) { + // TODO(bugs.webrtc.org/11993): This is called via WebRtcAudioReceiveStream, + // expect to be called on the network thread. + RTC_DCHECK_RUN_ON(&worker_thread_checker_); + channel_receive_->SetFrameDecryptor(std::move(frame_decryptor)); +} + webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats( bool get_and_clear_legacy_stats) const { RTC_DCHECK_RUN_ON(&worker_thread_checker_);