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

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

Issue 2844803003: Have AudioSendStream register CNG payload types with the RtpRtcpModule. (Closed)
Patch Set: Add mocks for GetRtpRtcp in AudioSendStreamTest. Created 3 years, 7 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
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "webrtc/audio/audio_send_stream.h" 15 #include "webrtc/audio/audio_send_stream.h"
16 #include "webrtc/audio/audio_state.h" 16 #include "webrtc/audio/audio_state.h"
17 #include "webrtc/audio/conversion.h" 17 #include "webrtc/audio/conversion.h"
18 #include "webrtc/base/task_queue.h" 18 #include "webrtc/base/task_queue.h"
19 #include "webrtc/call/rtp_transport_controller_send_interface.h" 19 #include "webrtc/call/rtp_transport_controller_send_interface.h"
20 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" 20 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
21 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h" 21 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h"
22 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder_factory.h" 22 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder_factory.h"
23 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" 23 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
24 #include "webrtc/modules/audio_processing/include/mock_audio_processing.h" 24 #include "webrtc/modules/audio_processing/include/mock_audio_processing.h"
25 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_obse rver.h" 25 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_obse rver.h"
26 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont roller.h" 26 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont roller.h"
27 #include "webrtc/modules/pacing/paced_sender.h" 27 #include "webrtc/modules/pacing/paced_sender.h"
28 #include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
28 #include "webrtc/modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h" 29 #include "webrtc/modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h"
29 #include "webrtc/test/gtest.h" 30 #include "webrtc/test/gtest.h"
30 #include "webrtc/test/mock_voe_channel_proxy.h" 31 #include "webrtc/test/mock_voe_channel_proxy.h"
31 #include "webrtc/test/mock_voice_engine.h" 32 #include "webrtc/test/mock_voice_engine.h"
32 #include "webrtc/voice_engine/transmit_mixer.h" 33 #include "webrtc/voice_engine/transmit_mixer.h"
33 34
34 namespace webrtc { 35 namespace webrtc {
35 namespace test { 36 namespace test {
36 namespace { 37 namespace {
37 38
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } 211 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; }
211 RtpTransportControllerSendInterface* transport() { return &fake_transport_; } 212 RtpTransportControllerSendInterface* transport() { return &fake_transport_; }
212 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } 213 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; }
213 rtc::TaskQueue* worker_queue() { return &worker_queue_; } 214 rtc::TaskQueue* worker_queue() { return &worker_queue_; }
214 RtcEventLog* event_log() { return &event_log_; } 215 RtcEventLog* event_log() { return &event_log_; }
215 MockVoiceEngine* voice_engine() { return &voice_engine_; } 216 MockVoiceEngine* voice_engine() { return &voice_engine_; }
216 217
217 void SetupDefaultChannelProxy(bool audio_bwe_enabled) { 218 void SetupDefaultChannelProxy(bool audio_bwe_enabled) {
218 using testing::StrEq; 219 using testing::StrEq;
219 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); 220 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
221 EXPECT_CALL(*channel_proxy_, GetRtpRtcp(_, _))
222 .WillRepeatedly(Invoke(
223 [this](RtpRtcp** rtp_rtcp_module, RtpReceiver** rtp_receiver) {
224 *rtp_rtcp_module = &this->rtp_rtcp_;
225 *rtp_receiver = nullptr; // Not deemed necessary for tests yet.
226 }));
220 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); 227 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1);
221 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1); 228 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1);
222 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1); 229 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1);
223 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 10)).Times(1); 230 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 10)).Times(1);
224 EXPECT_CALL(*channel_proxy_, 231 EXPECT_CALL(*channel_proxy_,
225 SetSendAudioLevelIndicationStatus(true, kAudioLevelId)) 232 SetSendAudioLevelIndicationStatus(true, kAudioLevelId))
226 .Times(1); 233 .Times(1);
227 if (audio_bwe_enabled) { 234 if (audio_bwe_enabled) {
228 EXPECT_CALL(*channel_proxy_, 235 EXPECT_CALL(*channel_proxy_,
229 EnableSendTransportSequenceNumber(kTransportSequenceNumberId)) 236 EnableSendTransportSequenceNumber(kTransportSequenceNumberId))
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 testing::StrictMock<MockVoiceEngine> voice_engine_; 321 testing::StrictMock<MockVoiceEngine> voice_engine_;
315 rtc::scoped_refptr<AudioState> audio_state_; 322 rtc::scoped_refptr<AudioState> audio_state_;
316 AudioSendStream::Config stream_config_; 323 AudioSendStream::Config stream_config_;
317 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 324 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
318 testing::NiceMock<MockCongestionObserver> bitrate_observer_; 325 testing::NiceMock<MockCongestionObserver> bitrate_observer_;
319 MockAudioProcessing audio_processing_; 326 MockAudioProcessing audio_processing_;
320 MockTransmitMixer transmit_mixer_; 327 MockTransmitMixer transmit_mixer_;
321 AudioProcessing::AudioProcessingStatistics audio_processing_stats_; 328 AudioProcessing::AudioProcessingStatistics audio_processing_stats_;
322 FakeRtpTransportController fake_transport_; 329 FakeRtpTransportController fake_transport_;
323 MockRtcEventLog event_log_; 330 MockRtcEventLog event_log_;
331 MockRtpRtcp rtp_rtcp_;
324 MockRtcpRttStats rtcp_rtt_stats_; 332 MockRtcpRttStats rtcp_rtt_stats_;
325 testing::NiceMock<MockLimitObserver> limit_observer_; 333 testing::NiceMock<MockLimitObserver> limit_observer_;
326 BitrateAllocator bitrate_allocator_; 334 BitrateAllocator bitrate_allocator_;
327 // |worker_queue| is defined last to ensure all pending tasks are cancelled 335 // |worker_queue| is defined last to ensure all pending tasks are cancelled
328 // and deleted before any other members. 336 // and deleted before any other members.
329 rtc::TaskQueue worker_queue_; 337 rtc::TaskQueue worker_queue_;
330 }; 338 };
331 } // namespace 339 } // namespace
332 340
333 TEST(AudioSendStreamTest, ConfigToString) { 341 TEST(AudioSendStreamTest, ConfigToString) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 stream_config.send_codec_spec->cng_payload_type = rtc::Optional<int>(105); 554 stream_config.send_codec_spec->cng_payload_type = rtc::Optional<int>(105);
547 internal::AudioSendStream send_stream( 555 internal::AudioSendStream send_stream(
548 stream_config, helper.audio_state(), helper.worker_queue(), 556 stream_config, helper.audio_state(), helper.worker_queue(),
549 helper.transport(), helper.bitrate_allocator(), helper.event_log(), 557 helper.transport(), helper.bitrate_allocator(), helper.event_log(),
550 helper.rtcp_rtt_stats()); 558 helper.rtcp_rtt_stats());
551 send_stream.Reconfigure(stream_config); 559 send_stream.Reconfigure(stream_config);
552 } 560 }
553 561
554 } // namespace test 562 } // namespace test
555 } // namespace webrtc 563 } // 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