From 6f0b9fda5343ec31bcc6aba67fb3e8d5f3c4e0e2 Mon Sep 17 00:00:00 2001 From: minyue Date: Mon, 14 Nov 2016 00:51:50 -0800 Subject: [PATCH] Allowing resetting of AudioNetworkAdaptor in AudioSendStream. BUG=webrtc:6681 Review-Url: https://codereview.webrtc.org/2495833002 Cr-Commit-Position: refs/heads/master@{#15058} --- webrtc/audio/audio_send_stream.cc | 8 ++++++-- webrtc/audio/audio_send_stream_unittest.cc | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webrtc/audio/audio_send_stream.cc b/webrtc/audio/audio_send_stream.cc index fef5b1d8ef..70bb6a9072 100644 --- a/webrtc/audio/audio_send_stream.cc +++ b/webrtc/audio/audio_send_stream.cc @@ -292,6 +292,12 @@ bool AudioSendStream::SetupSendCodec() { codec->SetVADStatus(channel, false); codec->SetFECStatus(channel, false); + // We disable audio network adaptor here. This will on one hand make sure that + // audio network adaptor is disabled by default, and on the other allow audio + // network adaptor to be reconfigured, since SetReceiverFrameLengthRange can + // be only called when audio network adaptor is disabled. + channel_proxy_->DisableAudioNetworkAdaptor(); + const auto& send_codec_spec = config_.send_codec_spec; // We set the codec first, since the below extra configuration is only applied @@ -345,8 +351,6 @@ bool AudioSendStream::SetupSendCodec() { *config_.audio_network_adaptor_config); LOG(LS_INFO) << "Audio network adaptor enabled on SSRC " << config_.rtp.ssrc; - } else { - channel_proxy_->DisableAudioNetworkAdaptor(); } } diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc index bd7ffb7751..fc7bbb0b80 100644 --- a/webrtc/audio/audio_send_stream_unittest.cc +++ b/webrtc/audio/audio_send_stream_unittest.cc @@ -142,6 +142,7 @@ struct ConfigHelper { .WillOnce(Return(0)); EXPECT_CALL(voice_engine_, SetFECStatus(kChannelId, false)) .WillOnce(Return(0)); + EXPECT_CALL(*channel_proxy_, DisableAudioNetworkAdaptor()); // Let |GetSendCodec| return -1 for the first time to indicate that no send // codec has been set. EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _))