Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1062)

Side by Side Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 2966503002: Always ResetSenderCongestionControlObjects before RegisterEtc... (Closed)
Patch Set: Added a test to ensure Reset is called first. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 stream_config_.send_codec_spec = 166 stream_config_.send_codec_spec =
167 rtc::Optional<AudioSendStream::Config::SendCodecSpec>( 167 rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
168 {kIsacPayloadType, kIsacFormat}); 168 {kIsacPayloadType, kIsacFormat});
169 stream_config_.voe_channel_id = kChannelId; 169 stream_config_.voe_channel_id = kChannelId;
170 stream_config_.rtp.ssrc = kSsrc; 170 stream_config_.rtp.ssrc = kSsrc;
171 stream_config_.rtp.nack.rtp_history_ms = 200; 171 stream_config_.rtp.nack.rtp_history_ms = 200;
172 stream_config_.rtp.c_name = kCName; 172 stream_config_.rtp.c_name = kCName;
173 stream_config_.rtp.extensions.push_back( 173 stream_config_.rtp.extensions.push_back(
174 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); 174 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId));
175 if (audio_bwe_enabled) { 175 if (audio_bwe_enabled) {
176 stream_config_.rtp.extensions.push_back( 176 AddBweToConfig(&stream_config_);
177 RtpExtension(RtpExtension::kTransportSequenceNumberUri,
178 kTransportSequenceNumberId));
179 stream_config_.send_codec_spec->transport_cc_enabled = true;
180 } 177 }
181 stream_config_.encoder_factory = SetupEncoderFactoryMock(); 178 stream_config_.encoder_factory = SetupEncoderFactoryMock();
182 stream_config_.min_bitrate_bps = 10000; 179 stream_config_.min_bitrate_bps = 10000;
183 stream_config_.max_bitrate_bps = 65000; 180 stream_config_.max_bitrate_bps = 65000;
184 } 181 }
185 182
186 AudioSendStream::Config& config() { return stream_config_; } 183 AudioSendStream::Config& config() { return stream_config_; }
187 MockAudioEncoderFactory& mock_encoder_factory() { 184 MockAudioEncoderFactory& mock_encoder_factory() {
188 return *static_cast<MockAudioEncoderFactory*>( 185 return *static_cast<MockAudioEncoderFactory*>(
189 stream_config_.encoder_factory.get()); 186 stream_config_.encoder_factory.get());
190 } 187 }
191 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } 188 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; }
192 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } 189 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; }
193 RtpTransportControllerSendInterface* transport() { return &fake_transport_; } 190 RtpTransportControllerSendInterface* transport() { return &fake_transport_; }
194 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } 191 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; }
195 rtc::TaskQueue* worker_queue() { return &worker_queue_; } 192 rtc::TaskQueue* worker_queue() { return &worker_queue_; }
196 RtcEventLog* event_log() { return &event_log_; } 193 RtcEventLog* event_log() { return &event_log_; }
197 MockVoiceEngine* voice_engine() { return &voice_engine_; } 194 MockVoiceEngine* voice_engine() { return &voice_engine_; }
198 195
196 static void AddBweToConfig(AudioSendStream::Config* config) {
197 config->rtp.extensions.push_back(
198 RtpExtension(RtpExtension::kTransportSequenceNumberUri,
199 kTransportSequenceNumberId));
200 config->send_codec_spec->transport_cc_enabled = true;
201 }
202
199 void SetupDefaultChannelProxy(bool audio_bwe_enabled) { 203 void SetupDefaultChannelProxy(bool audio_bwe_enabled) {
200 using testing::StrEq; 204 using testing::StrEq;
201 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); 205 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
202 EXPECT_CALL(*channel_proxy_, GetRtpRtcp(_, _)) 206 EXPECT_CALL(*channel_proxy_, GetRtpRtcp(_, _))
203 .WillRepeatedly(Invoke( 207 .WillRepeatedly(Invoke(
204 [this](RtpRtcp** rtp_rtcp_module, RtpReceiver** rtp_receiver) { 208 [this](RtpRtcp** rtp_rtcp_module, RtpReceiver** rtp_receiver) {
205 *rtp_rtcp_module = &this->rtp_rtcp_; 209 *rtp_rtcp_module = &this->rtp_rtcp_;
206 *rtp_receiver = nullptr; // Not deemed necessary for tests yet. 210 *rtp_receiver = nullptr; // Not deemed necessary for tests yet.
207 })); 211 }));
208 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); 212 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 stream_config.send_codec_spec = 539 stream_config.send_codec_spec =
536 rtc::Optional<AudioSendStream::Config::SendCodecSpec>({9, kG722Format}); 540 rtc::Optional<AudioSendStream::Config::SendCodecSpec>({9, kG722Format});
537 stream_config.send_codec_spec->cng_payload_type = rtc::Optional<int>(105); 541 stream_config.send_codec_spec->cng_payload_type = rtc::Optional<int>(105);
538 internal::AudioSendStream send_stream( 542 internal::AudioSendStream send_stream(
539 stream_config, helper.audio_state(), helper.worker_queue(), 543 stream_config, helper.audio_state(), helper.worker_queue(),
540 helper.transport(), helper.bitrate_allocator(), helper.event_log(), 544 helper.transport(), helper.bitrate_allocator(), helper.event_log(),
541 helper.rtcp_rtt_stats(), rtc::Optional<RtpState>()); 545 helper.rtcp_rtt_stats(), rtc::Optional<RtpState>());
542 send_stream.Reconfigure(stream_config); 546 send_stream.Reconfigure(stream_config);
543 } 547 }
544 548
549 TEST(AudioSendStreamTest, ReconfigureTransportCcResetsFirst) {
550 ConfigHelper helper(false, true);
551 internal::AudioSendStream send_stream(
552 helper.config(), helper.audio_state(), helper.worker_queue(),
553 helper.transport(), helper.bitrate_allocator(), helper.event_log(),
554 helper.rtcp_rtt_stats(), rtc::Optional<RtpState>());
555 auto new_config = helper.config();
556 ConfigHelper::AddBweToConfig(&new_config);
557 EXPECT_CALL(*helper.channel_proxy(),
558 EnableSendTransportSequenceNumber(kTransportSequenceNumberId))
559 .Times(1);
560 {
561 ::testing::InSequence seq;
562 EXPECT_CALL(*helper.channel_proxy(), ResetSenderCongestionControlObjects())
563 .Times(1);
564 EXPECT_CALL(*helper.channel_proxy(), RegisterSenderCongestionControlObjects(
565 helper.transport(), Ne(nullptr)))
566 .Times(1);
567 }
568 send_stream.Reconfigure(new_config);
569 }
570
571
545 } // namespace test 572 } // namespace test
546 } // namespace webrtc 573 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698