OLD | NEW |
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 <vector> | 12 #include <vector> |
13 | 13 |
14 #include "webrtc/audio/audio_send_stream.h" | 14 #include "webrtc/audio/audio_send_stream.h" |
15 #include "webrtc/audio/audio_state.h" | 15 #include "webrtc/audio/audio_state.h" |
16 #include "webrtc/audio/conversion.h" | 16 #include "webrtc/audio/conversion.h" |
17 #include "webrtc/base/task_queue.h" | 17 #include "webrtc/base/task_queue.h" |
18 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" | 18 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" |
| 19 #include "webrtc/modules/audio_device/include/mock_audio_device.h" |
19 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 20 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
20 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont
roller.h" | 21 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont
roller.h" |
21 #include "webrtc/modules/pacing/paced_sender.h" | 22 #include "webrtc/modules/pacing/paced_sender.h" |
22 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_estimator.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_estimator.h" |
23 #include "webrtc/test/gtest.h" | 24 #include "webrtc/test/gtest.h" |
24 #include "webrtc/test/mock_voe_channel_proxy.h" | 25 #include "webrtc/test/mock_voe_channel_proxy.h" |
25 #include "webrtc/test/mock_voice_engine.h" | 26 #include "webrtc/test/mock_voice_engine.h" |
26 | 27 |
27 namespace webrtc { | 28 namespace webrtc { |
28 namespace test { | 29 namespace test { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 : simulated_clock_(123456), | 63 : simulated_clock_(123456), |
63 stream_config_(nullptr), | 64 stream_config_(nullptr), |
64 congestion_controller_(&simulated_clock_, | 65 congestion_controller_(&simulated_clock_, |
65 &bitrate_observer_, | 66 &bitrate_observer_, |
66 &remote_bitrate_observer_, | 67 &remote_bitrate_observer_, |
67 &event_log_), | 68 &event_log_), |
68 bitrate_allocator_(&limit_observer_), | 69 bitrate_allocator_(&limit_observer_), |
69 worker_queue_("ConfigHelper_worker_queue") { | 70 worker_queue_("ConfigHelper_worker_queue") { |
70 using testing::Invoke; | 71 using testing::Invoke; |
71 | 72 |
72 EXPECT_CALL(voice_engine_, | 73 EXPECT_CALL(voice_engine_, RegisterVoiceEngineObserver(_)) |
73 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); | 74 .WillOnce(Return(0)); |
74 EXPECT_CALL(voice_engine_, | 75 EXPECT_CALL(voice_engine_, DeRegisterVoiceEngineObserver()) |
75 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); | 76 .WillOnce(Return(0)); |
| 77 EXPECT_CALL(voice_engine_, audio_transport()); |
| 78 EXPECT_CALL(voice_engine_, audio_processing()); |
| 79 EXPECT_CALL(voice_engine_, audio_device_module()); |
| 80 ON_CALL(voice_engine_, audio_device_module()) |
| 81 .WillByDefault(Return(&mock_audio_device_)); |
76 AudioState::Config config; | 82 AudioState::Config config; |
77 config.voice_engine = &voice_engine_; | 83 config.voice_engine = &voice_engine_; |
78 audio_state_ = AudioState::Create(config); | 84 audio_state_ = AudioState::Create(config); |
79 | 85 |
80 SetupDefaultChannelProxy(); | 86 SetupDefaultChannelProxy(); |
81 | 87 |
82 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) | 88 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) |
83 .WillOnce(Invoke([this](int channel_id) { | 89 .WillOnce(Invoke([this](int channel_id) { |
84 return channel_proxy_; | 90 return channel_proxy_; |
85 })); | 91 })); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 SetArgReferee<1>(kEchoReturnLossEnhancement), | 194 SetArgReferee<1>(kEchoReturnLossEnhancement), |
189 Return(0))); | 195 Return(0))); |
190 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) | 196 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) |
191 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), | 197 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), |
192 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); | 198 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); |
193 } | 199 } |
194 | 200 |
195 private: | 201 private: |
196 SimulatedClock simulated_clock_; | 202 SimulatedClock simulated_clock_; |
197 testing::StrictMock<MockVoiceEngine> voice_engine_; | 203 testing::StrictMock<MockVoiceEngine> voice_engine_; |
| 204 testing::NiceMock<webrtc::test::MockAudioDeviceModule> mock_audio_device_; |
198 rtc::scoped_refptr<AudioState> audio_state_; | 205 rtc::scoped_refptr<AudioState> audio_state_; |
199 AudioSendStream::Config stream_config_; | 206 AudioSendStream::Config stream_config_; |
200 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 207 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
201 testing::NiceMock<MockCongestionObserver> bitrate_observer_; | 208 testing::NiceMock<MockCongestionObserver> bitrate_observer_; |
202 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; | 209 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; |
203 CongestionController congestion_controller_; | 210 CongestionController congestion_controller_; |
204 MockRtcEventLog event_log_; | 211 MockRtcEventLog event_log_; |
205 testing::NiceMock<MockLimitObserver> limit_observer_; | 212 testing::NiceMock<MockLimitObserver> limit_observer_; |
206 BitrateAllocator bitrate_allocator_; | 213 BitrateAllocator bitrate_allocator_; |
207 // |worker_queue| is defined last to ensure all pending tasks are cancelled | 214 // |worker_queue| is defined last to ensure all pending tasks are cancelled |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) | 383 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) |
377 .WillOnce(Return(0)); | 384 .WillOnce(Return(0)); |
378 internal::AudioSendStream send_stream( | 385 internal::AudioSendStream send_stream( |
379 stream_config, helper.audio_state(), helper.worker_queue(), | 386 stream_config, helper.audio_state(), helper.worker_queue(), |
380 helper.congestion_controller(), helper.bitrate_allocator(), | 387 helper.congestion_controller(), helper.bitrate_allocator(), |
381 helper.event_log()); | 388 helper.event_log()); |
382 } | 389 } |
383 | 390 |
384 } // namespace test | 391 } // namespace test |
385 } // namespace webrtc | 392 } // namespace webrtc |
OLD | NEW |