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 "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/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_estimator.h" |
23 #include "webrtc/test/mock_voe_channel_proxy.h" | 23 #include "webrtc/test/mock_voe_channel_proxy.h" |
24 #include "webrtc/test/mock_voice_engine.h" | 24 #include "webrtc/test/mock_voice_engine.h" |
25 #include "webrtc/video/call_stats.h" | |
26 | 25 |
27 namespace webrtc { | 26 namespace webrtc { |
28 namespace test { | 27 namespace test { |
29 namespace { | 28 namespace { |
30 | 29 |
31 using testing::_; | 30 using testing::_; |
32 using testing::Return; | 31 using testing::Return; |
33 | 32 |
34 const int kChannelId = 1; | 33 const int kChannelId = 1; |
35 const uint32_t kSsrc = 1234; | 34 const uint32_t kSsrc = 1234; |
(...skipping 11 matching lines...) Expand all Loading... |
47 const CodecInst kCodecInst = {-121, "codec_name_send", 48000, -231, 0, -671}; | 46 const CodecInst kCodecInst = {-121, "codec_name_send", 48000, -231, 0, -671}; |
48 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; | 47 const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; |
49 const int kTelephoneEventPayloadType = 123; | 48 const int kTelephoneEventPayloadType = 123; |
50 const uint8_t kTelephoneEventCode = 45; | 49 const uint8_t kTelephoneEventCode = 45; |
51 const uint32_t kTelephoneEventDuration = 6789; | 50 const uint32_t kTelephoneEventDuration = 6789; |
52 | 51 |
53 struct ConfigHelper { | 52 struct ConfigHelper { |
54 ConfigHelper() | 53 ConfigHelper() |
55 : simulated_clock_(123456), | 54 : simulated_clock_(123456), |
56 stream_config_(nullptr), | 55 stream_config_(nullptr), |
57 call_stats_(&simulated_clock_), | |
58 process_thread_(ProcessThread::Create("AudioTestThread")), | |
59 congestion_controller_(&simulated_clock_, | 56 congestion_controller_(&simulated_clock_, |
60 process_thread_.get(), | |
61 &call_stats_, | |
62 &bitrate_observer_, | 57 &bitrate_observer_, |
63 &remote_bitrate_observer_) { | 58 &remote_bitrate_observer_) { |
64 using testing::Invoke; | 59 using testing::Invoke; |
65 using testing::StrEq; | 60 using testing::StrEq; |
66 | 61 |
67 EXPECT_CALL(voice_engine_, | 62 EXPECT_CALL(voice_engine_, |
68 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); | 63 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); |
69 EXPECT_CALL(voice_engine_, | 64 EXPECT_CALL(voice_engine_, |
70 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); | 65 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); |
71 AudioState::Config config; | 66 AudioState::Config config; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), | 150 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), |
156 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); | 151 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); |
157 } | 152 } |
158 | 153 |
159 private: | 154 private: |
160 SimulatedClock simulated_clock_; | 155 SimulatedClock simulated_clock_; |
161 testing::StrictMock<MockVoiceEngine> voice_engine_; | 156 testing::StrictMock<MockVoiceEngine> voice_engine_; |
162 rtc::scoped_refptr<AudioState> audio_state_; | 157 rtc::scoped_refptr<AudioState> audio_state_; |
163 AudioSendStream::Config stream_config_; | 158 AudioSendStream::Config stream_config_; |
164 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 159 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
165 CallStats call_stats_; | |
166 testing::NiceMock<MockBitrateObserver> bitrate_observer_; | 160 testing::NiceMock<MockBitrateObserver> bitrate_observer_; |
167 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; | 161 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; |
168 rtc::scoped_ptr<ProcessThread> process_thread_; | |
169 CongestionController congestion_controller_; | 162 CongestionController congestion_controller_; |
170 }; | 163 }; |
171 } // namespace | 164 } // namespace |
172 | 165 |
173 TEST(AudioSendStreamTest, ConfigToString) { | 166 TEST(AudioSendStreamTest, ConfigToString) { |
174 AudioSendStream::Config config(nullptr); | 167 AudioSendStream::Config config(nullptr); |
175 config.rtp.ssrc = kSsrc; | 168 config.rtp.ssrc = kSsrc; |
176 config.rtp.extensions.push_back( | 169 config.rtp.extensions.push_back( |
177 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); | 170 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); |
178 config.rtp.c_name = kCName; | 171 config.rtp.c_name = kCName; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 static_cast<internal::AudioState*>(helper.audio_state().get()); | 234 static_cast<internal::AudioState*>(helper.audio_state().get()); |
242 VoiceEngineObserver* voe_observer = | 235 VoiceEngineObserver* voe_observer = |
243 static_cast<VoiceEngineObserver*>(internal_audio_state); | 236 static_cast<VoiceEngineObserver*>(internal_audio_state); |
244 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); | 237 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); |
245 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); | 238 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); |
246 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); | 239 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); |
247 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); | 240 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); |
248 } | 241 } |
249 } // namespace test | 242 } // namespace test |
250 } // namespace webrtc | 243 } // namespace webrtc |
OLD | NEW |