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

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

Issue 1704983002: Simplify CongestionController. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 4 years, 10 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 | « no previous file | webrtc/audio/audio_send_stream_unittest.cc » ('j') | 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 <vector> 12 #include <vector>
13 13
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 #include "webrtc/audio/audio_receive_stream.h" 16 #include "webrtc/audio/audio_receive_stream.h"
17 #include "webrtc/audio/conversion.h" 17 #include "webrtc/audio/conversion.h"
18 #include "webrtc/call/mock/mock_congestion_controller.h" 18 #include "webrtc/call/mock/mock_congestion_controller.h"
19 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h" 19 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h"
20 #include "webrtc/modules/pacing/packet_router.h" 20 #include "webrtc/modules/pacing/packet_router.h"
21 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h" 21 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h"
22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
23 #include "webrtc/modules/utility/include/mock/mock_process_thread.h"
24 #include "webrtc/system_wrappers/include/clock.h" 23 #include "webrtc/system_wrappers/include/clock.h"
25 #include "webrtc/test/mock_voe_channel_proxy.h" 24 #include "webrtc/test/mock_voe_channel_proxy.h"
26 #include "webrtc/test/mock_voice_engine.h" 25 #include "webrtc/test/mock_voice_engine.h"
27 #include "webrtc/video/call_stats.h"
28 26
29 namespace webrtc { 27 namespace webrtc {
30 namespace test { 28 namespace test {
31 namespace { 29 namespace {
32 30
33 using testing::_; 31 using testing::_;
34 using testing::Return; 32 using testing::Return;
35 33
36 AudioDecodingCallStats MakeAudioDecodeStatsForTest() { 34 AudioDecodingCallStats MakeAudioDecodeStatsForTest() {
37 AudioDecodingCallStats audio_decode_stats; 35 AudioDecodingCallStats audio_decode_stats;
(...skipping 21 matching lines...) Expand all
59 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123}; 57 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123};
60 const CodecInst kCodecInst = { 58 const CodecInst kCodecInst = {
61 123, "codec_name_recv", 96000, -187, 0, -103}; 59 123, "codec_name_recv", 96000, -187, 0, -103};
62 const NetworkStatistics kNetworkStats = { 60 const NetworkStatistics kNetworkStats = {
63 123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0}; 61 123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0};
64 const AudioDecodingCallStats kAudioDecodeStats = MakeAudioDecodeStatsForTest(); 62 const AudioDecodingCallStats kAudioDecodeStats = MakeAudioDecodeStatsForTest();
65 63
66 struct ConfigHelper { 64 struct ConfigHelper {
67 ConfigHelper() 65 ConfigHelper()
68 : simulated_clock_(123456), 66 : simulated_clock_(123456),
69 call_stats_(&simulated_clock_),
70 congestion_controller_(&simulated_clock_, 67 congestion_controller_(&simulated_clock_,
71 &process_thread_,
72 &call_stats_,
73 &bitrate_observer_, 68 &bitrate_observer_,
74 &remote_bitrate_observer_) { 69 &remote_bitrate_observer_) {
75 using testing::Invoke; 70 using testing::Invoke;
76 71
77 EXPECT_CALL(voice_engine_, 72 EXPECT_CALL(voice_engine_,
78 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); 73 RegisterVoiceEngineObserver(_)).WillOnce(Return(0));
79 EXPECT_CALL(voice_engine_, 74 EXPECT_CALL(voice_engine_,
80 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); 75 DeRegisterVoiceEngineObserver()).WillOnce(Return(0));
81 AudioState::Config config; 76 AudioState::Config config;
82 config.voice_engine = &voice_engine_; 77 config.voice_engine = &voice_engine_;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 .WillOnce(Return(kNetworkStats)); 144 .WillOnce(Return(kNetworkStats));
150 EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics()) 145 EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics())
151 .WillOnce(Return(kAudioDecodeStats)); 146 .WillOnce(Return(kAudioDecodeStats));
152 147
153 EXPECT_CALL(voice_engine_, GetRecCodec(kChannelId, _)) 148 EXPECT_CALL(voice_engine_, GetRecCodec(kChannelId, _))
154 .WillOnce(DoAll(SetArgReferee<1>(kCodecInst), Return(0))); 149 .WillOnce(DoAll(SetArgReferee<1>(kCodecInst), Return(0)));
155 } 150 }
156 151
157 private: 152 private:
158 SimulatedClock simulated_clock_; 153 SimulatedClock simulated_clock_;
159 CallStats call_stats_;
160 PacketRouter packet_router_; 154 PacketRouter packet_router_;
161 testing::NiceMock<MockBitrateObserver> bitrate_observer_; 155 testing::NiceMock<MockBitrateObserver> bitrate_observer_;
162 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; 156 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
163 testing::NiceMock<MockProcessThread> process_thread_;
164 MockCongestionController congestion_controller_; 157 MockCongestionController congestion_controller_;
165 MockRemoteBitrateEstimator remote_bitrate_estimator_; 158 MockRemoteBitrateEstimator remote_bitrate_estimator_;
166 testing::StrictMock<MockVoiceEngine> voice_engine_; 159 testing::StrictMock<MockVoiceEngine> voice_engine_;
167 rtc::scoped_refptr<AudioState> audio_state_; 160 rtc::scoped_refptr<AudioState> audio_state_;
168 AudioReceiveStream::Config stream_config_; 161 AudioReceiveStream::Config stream_config_;
169 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 162 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
170 }; 163 };
171 164
172 void BuildOneByteExtension(std::vector<uint8_t>::iterator it, 165 void BuildOneByteExtension(std::vector<uint8_t>::iterator it,
173 int id, 166 int id,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); 294 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq);
302 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); 295 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal);
303 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); 296 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc);
304 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); 297 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng);
305 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); 298 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng);
306 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, 299 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_,
307 stats.capture_start_ntp_time_ms); 300 stats.capture_start_ntp_time_ms);
308 } 301 }
309 } // namespace test 302 } // namespace test
310 } // namespace webrtc 303 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/audio/audio_send_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698