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

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

Issue 1663413003: Clean up of 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
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_send_stream.h" 16 #include "webrtc/audio/audio_send_stream.h"
17 #include "webrtc/audio/audio_state.h" 17 #include "webrtc/audio/audio_state.h"
18 #include "webrtc/audio/conversion.h" 18 #include "webrtc/audio/conversion.h"
19 #include "webrtc/call/congestion_controller.h" 19 #include "webrtc/call/congestion_controller.h"
20 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h" 20 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h"
21 #include "webrtc/modules/pacing/paced_sender.h" 21 #include "webrtc/modules/pacing/paced_sender.h"
22 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h"
22 #include "webrtc/test/mock_voe_channel_proxy.h" 23 #include "webrtc/test/mock_voe_channel_proxy.h"
23 #include "webrtc/test/mock_voice_engine.h" 24 #include "webrtc/test/mock_voice_engine.h"
24 #include "webrtc/video/call_stats.h" 25 #include "webrtc/video/call_stats.h"
25 26
26 namespace webrtc { 27 namespace webrtc {
27 namespace test { 28 namespace test {
28 namespace { 29 namespace {
29 30
30 using testing::_; 31 using testing::_;
31 using testing::Return; 32 using testing::Return;
(...skipping 12 matching lines...) Expand all
44 const CallStatistics kCallStats = { 45 const CallStatistics kCallStats = {
45 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123}; 46 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123};
46 const CodecInst kCodecInst = {-121, "codec_name_send", 48000, -231, 0, -671}; 47 const CodecInst kCodecInst = {-121, "codec_name_send", 48000, -231, 0, -671};
47 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; 48 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354};
48 const int kTelephoneEventPayloadType = 123; 49 const int kTelephoneEventPayloadType = 123;
49 const uint8_t kTelephoneEventCode = 45; 50 const uint8_t kTelephoneEventCode = 45;
50 const uint32_t kTelephoneEventDuration = 6789; 51 const uint32_t kTelephoneEventDuration = 6789;
51 52
52 struct ConfigHelper { 53 struct ConfigHelper {
53 ConfigHelper() 54 ConfigHelper()
54 : stream_config_(nullptr), 55 : simulated_clock_(123456),
55 call_stats_(Clock::GetRealTimeClock()), 56 stream_config_(nullptr),
57 call_stats_(&simulated_clock_),
56 process_thread_(ProcessThread::Create("AudioTestThread")), 58 process_thread_(ProcessThread::Create("AudioTestThread")),
57 congestion_controller_(process_thread_.get(), 59 congestion_controller_(&simulated_clock_,
60 process_thread_.get(),
58 &call_stats_, 61 &call_stats_,
59 &bitrate_observer_) { 62 &bitrate_observer_,
63 &remote_bitrate_observer_) {
60 using testing::Invoke; 64 using testing::Invoke;
61 using testing::StrEq; 65 using testing::StrEq;
62 66
63 EXPECT_CALL(voice_engine_, 67 EXPECT_CALL(voice_engine_,
64 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); 68 RegisterVoiceEngineObserver(_)).WillOnce(Return(0));
65 EXPECT_CALL(voice_engine_, 69 EXPECT_CALL(voice_engine_,
66 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); 70 DeRegisterVoiceEngineObserver()).WillOnce(Return(0));
67 AudioState::Config config; 71 AudioState::Config config;
68 config.voice_engine = &voice_engine_; 72 config.voice_engine = &voice_engine_;
69 audio_state_ = AudioState::Create(config); 73 audio_state_ = AudioState::Create(config);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _)) 150 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _))
147 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss), 151 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss),
148 SetArgReferee<1>(kEchoReturnLossEnhancement), 152 SetArgReferee<1>(kEchoReturnLossEnhancement),
149 Return(0))); 153 Return(0)));
150 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) 154 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _))
151 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), 155 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian),
152 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); 156 SetArgReferee<1>(kEchoDelayStdDev), Return(0)));
153 } 157 }
154 158
155 private: 159 private:
160 SimulatedClock simulated_clock_;
156 testing::StrictMock<MockVoiceEngine> voice_engine_; 161 testing::StrictMock<MockVoiceEngine> voice_engine_;
157 rtc::scoped_refptr<AudioState> audio_state_; 162 rtc::scoped_refptr<AudioState> audio_state_;
158 AudioSendStream::Config stream_config_; 163 AudioSendStream::Config stream_config_;
159 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 164 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
160 CallStats call_stats_; 165 CallStats call_stats_;
161 testing::NiceMock<MockBitrateObserver> bitrate_observer_; 166 testing::NiceMock<MockBitrateObserver> bitrate_observer_;
167 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
162 rtc::scoped_ptr<ProcessThread> process_thread_; 168 rtc::scoped_ptr<ProcessThread> process_thread_;
163 CongestionController congestion_controller_; 169 CongestionController congestion_controller_;
164 }; 170 };
165 } // namespace 171 } // namespace
166 172
167 TEST(AudioSendStreamTest, ConfigToString) { 173 TEST(AudioSendStreamTest, ConfigToString) {
168 AudioSendStream::Config config(nullptr); 174 AudioSendStream::Config config(nullptr);
169 config.rtp.ssrc = kSsrc; 175 config.rtp.ssrc = kSsrc;
170 config.rtp.extensions.push_back( 176 config.rtp.extensions.push_back(
171 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); 177 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 static_cast<internal::AudioState*>(helper.audio_state().get()); 241 static_cast<internal::AudioState*>(helper.audio_state().get());
236 VoiceEngineObserver* voe_observer = 242 VoiceEngineObserver* voe_observer =
237 static_cast<VoiceEngineObserver*>(internal_audio_state); 243 static_cast<VoiceEngineObserver*>(internal_audio_state);
238 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); 244 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING);
239 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); 245 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected);
240 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); 246 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING);
241 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); 247 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected);
242 } 248 }
243 } // namespace test 249 } // namespace test
244 } // namespace webrtc 250 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698