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_mixer/audio_mixer_impl.h" | 19 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
20 #include "webrtc/modules/audio_processing/include/mock_audio_processing.h" | 20 #include "webrtc/modules/audio_processing/include/mock_audio_processing.h" |
21 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 21 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
22 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont
roller.h" | 22 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont
roller.h" |
23 #include "webrtc/modules/pacing/paced_sender.h" | 23 #include "webrtc/modules/pacing/paced_sender.h" |
24 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_estimator.h" | |
25 #include "webrtc/modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h" | 24 #include "webrtc/modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h" |
26 #include "webrtc/test/gtest.h" | 25 #include "webrtc/test/gtest.h" |
27 #include "webrtc/test/mock_voe_channel_proxy.h" | 26 #include "webrtc/test/mock_voe_channel_proxy.h" |
28 #include "webrtc/test/mock_voice_engine.h" | 27 #include "webrtc/test/mock_voice_engine.h" |
29 #include "webrtc/voice_engine/transmit_mixer.h" | 28 #include "webrtc/voice_engine/transmit_mixer.h" |
30 | 29 |
31 namespace webrtc { | 30 namespace webrtc { |
32 namespace test { | 31 namespace test { |
33 namespace { | 32 namespace { |
34 | 33 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 public: | 67 public: |
69 MOCK_CONST_METHOD0(AudioLevelFullRange, int16_t()); | 68 MOCK_CONST_METHOD0(AudioLevelFullRange, int16_t()); |
70 }; | 69 }; |
71 | 70 |
72 struct ConfigHelper { | 71 struct ConfigHelper { |
73 explicit ConfigHelper(bool audio_bwe_enabled) | 72 explicit ConfigHelper(bool audio_bwe_enabled) |
74 : simulated_clock_(123456), | 73 : simulated_clock_(123456), |
75 stream_config_(nullptr), | 74 stream_config_(nullptr), |
76 congestion_controller_(&simulated_clock_, | 75 congestion_controller_(&simulated_clock_, |
77 &bitrate_observer_, | 76 &bitrate_observer_, |
78 &remote_bitrate_observer_, | 77 nullptr, |
79 &event_log_, | 78 &event_log_, |
80 &packet_router_), | 79 &packet_router_), |
81 bitrate_allocator_(&limit_observer_), | 80 bitrate_allocator_(&limit_observer_), |
82 worker_queue_("ConfigHelper_worker_queue") { | 81 worker_queue_("ConfigHelper_worker_queue") { |
83 using testing::Invoke; | 82 using testing::Invoke; |
84 | 83 |
85 EXPECT_CALL(voice_engine_, | 84 EXPECT_CALL(voice_engine_, |
86 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); | 85 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); |
87 EXPECT_CALL(voice_engine_, | 86 EXPECT_CALL(voice_engine_, |
88 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); | 87 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 .WillRepeatedly(Return(audio_processing_stats_)); | 240 .WillRepeatedly(Return(audio_processing_stats_)); |
242 } | 241 } |
243 | 242 |
244 private: | 243 private: |
245 SimulatedClock simulated_clock_; | 244 SimulatedClock simulated_clock_; |
246 testing::StrictMock<MockVoiceEngine> voice_engine_; | 245 testing::StrictMock<MockVoiceEngine> voice_engine_; |
247 rtc::scoped_refptr<AudioState> audio_state_; | 246 rtc::scoped_refptr<AudioState> audio_state_; |
248 AudioSendStream::Config stream_config_; | 247 AudioSendStream::Config stream_config_; |
249 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 248 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
250 testing::NiceMock<MockCongestionObserver> bitrate_observer_; | 249 testing::NiceMock<MockCongestionObserver> bitrate_observer_; |
251 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; | |
252 MockAudioProcessing audio_processing_; | 250 MockAudioProcessing audio_processing_; |
253 MockTransmitMixer transmit_mixer_; | 251 MockTransmitMixer transmit_mixer_; |
254 AudioProcessing::AudioProcessingStatistics audio_processing_stats_; | 252 AudioProcessing::AudioProcessingStatistics audio_processing_stats_; |
255 PacketRouter packet_router_; | 253 PacketRouter packet_router_; |
256 CongestionController congestion_controller_; | 254 CongestionController congestion_controller_; |
257 MockRtcEventLog event_log_; | 255 MockRtcEventLog event_log_; |
258 MockRtcpRttStats rtcp_rtt_stats_; | 256 MockRtcpRttStats rtcp_rtt_stats_; |
259 testing::NiceMock<MockLimitObserver> limit_observer_; | 257 testing::NiceMock<MockLimitObserver> limit_observer_; |
260 BitrateAllocator bitrate_allocator_; | 258 BitrateAllocator bitrate_allocator_; |
261 // |worker_queue| is defined last to ensure all pending tasks are cancelled | 259 // |worker_queue| is defined last to ensure all pending tasks are cancelled |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 internal::AudioSendStream send_stream( | 467 internal::AudioSendStream send_stream( |
470 helper.config(), helper.audio_state(), helper.worker_queue(), | 468 helper.config(), helper.audio_state(), helper.worker_queue(), |
471 helper.packet_router(), helper.congestion_controller(), | 469 helper.packet_router(), helper.congestion_controller(), |
472 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); | 470 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); |
473 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000)); | 471 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000)); |
474 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000); | 472 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000); |
475 } | 473 } |
476 | 474 |
477 } // namespace test | 475 } // namespace test |
478 } // namespace webrtc | 476 } // namespace webrtc |
OLD | NEW |