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/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/test/mock_voe_channel_proxy.h" | 22 #include "webrtc/test/mock_voe_channel_proxy.h" |
23 #include "webrtc/test/mock_voice_engine.h" | 23 #include "webrtc/test/mock_voice_engine.h" |
24 #include "webrtc/video/call_stats.h" | 24 #include "webrtc/video/call_stats.h" |
25 | 25 |
26 namespace webrtc { | 26 namespace webrtc { |
27 namespace test { | 27 namespace test { |
28 namespace { | 28 namespace { |
29 | 29 |
30 using testing::_; | 30 using testing::_; |
(...skipping 29 matching lines...) Expand all Loading... | |
60 using testing::Invoke; | 60 using testing::Invoke; |
61 using testing::StrEq; | 61 using testing::StrEq; |
62 | 62 |
63 EXPECT_CALL(voice_engine_, | 63 EXPECT_CALL(voice_engine_, |
64 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); | 64 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); |
65 EXPECT_CALL(voice_engine_, | 65 EXPECT_CALL(voice_engine_, |
66 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); | 66 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); |
67 AudioState::Config config; | 67 AudioState::Config config; |
68 config.voice_engine = &voice_engine_; | 68 config.voice_engine = &voice_engine_; |
69 audio_state_ = AudioState::Create(config); | 69 audio_state_ = AudioState::Create(config); |
70 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); | |
the sun
2015/12/20 23:16:15
Why did this move?
stefan-webrtc
2015/12/21 08:01:29
Sorry, I can move this back. I had to move it init
the sun
2015/12/22 00:14:13
Please do.
| |
70 | 71 |
71 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) | 72 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) |
72 .WillOnce(Invoke([this](int channel_id) { | 73 .WillOnce(Invoke([this](int channel_id) { |
73 EXPECT_FALSE(channel_proxy_); | |
74 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); | |
75 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); | 74 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); |
76 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1); | 75 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1); |
77 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1); | 76 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1); |
78 EXPECT_CALL(*channel_proxy_, | 77 EXPECT_CALL(*channel_proxy_, |
79 SetSendAbsoluteSenderTimeStatus(true, kAbsSendTimeId)).Times(1); | 78 SetSendAbsoluteSenderTimeStatus(true, kAbsSendTimeId)).Times(1); |
80 EXPECT_CALL(*channel_proxy_, | 79 EXPECT_CALL(*channel_proxy_, |
81 SetSendAudioLevelIndicationStatus(true, kAudioLevelId)).Times(1); | 80 SetSendAudioLevelIndicationStatus(true, kAudioLevelId)).Times(1); |
82 EXPECT_CALL(*channel_proxy_, EnableSendTransportSequenceNumber( | 81 EXPECT_CALL(*channel_proxy_, EnableSendTransportSequenceNumber( |
83 kTransportSequenceNumberId)) | 82 kTransportSequenceNumberId)) |
84 .Times(1); | 83 .Times(1); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _)) | 146 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _)) |
148 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss), | 147 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss), |
149 SetArgReferee<1>(kEchoReturnLossEnhancement), | 148 SetArgReferee<1>(kEchoReturnLossEnhancement), |
150 Return(0))); | 149 Return(0))); |
151 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) | 150 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) |
152 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), | 151 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), |
153 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); | 152 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); |
154 } | 153 } |
155 | 154 |
156 private: | 155 private: |
157 class NullBitrateObserver : public BitrateObserver { | |
158 public: | |
159 virtual void OnNetworkChanged(uint32_t bitrate_bps, | |
160 uint8_t fraction_loss, | |
161 int64_t rtt_ms) {} | |
162 }; | |
163 | |
164 testing::StrictMock<MockVoiceEngine> voice_engine_; | 156 testing::StrictMock<MockVoiceEngine> voice_engine_; |
165 rtc::scoped_refptr<AudioState> audio_state_; | 157 rtc::scoped_refptr<AudioState> audio_state_; |
166 AudioSendStream::Config stream_config_; | 158 AudioSendStream::Config stream_config_; |
167 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 159 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
168 CallStats call_stats_; | 160 CallStats call_stats_; |
169 NullBitrateObserver bitrate_observer_; | 161 testing::NiceMock<MockBitrateObserver> bitrate_observer_; |
170 rtc::scoped_ptr<ProcessThread> process_thread_; | 162 rtc::scoped_ptr<ProcessThread> process_thread_; |
171 CongestionController congestion_controller_; | 163 CongestionController congestion_controller_; |
172 }; | 164 }; |
173 } // namespace | 165 } // namespace |
174 | 166 |
175 TEST(AudioSendStreamTest, ConfigToString) { | 167 TEST(AudioSendStreamTest, ConfigToString) { |
176 AudioSendStream::Config config(nullptr); | 168 AudioSendStream::Config config(nullptr); |
177 config.rtp.ssrc = kSsrc; | 169 config.rtp.ssrc = kSsrc; |
178 config.rtp.extensions.push_back( | 170 config.rtp.extensions.push_back( |
179 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); | 171 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 static_cast<internal::AudioState*>(helper.audio_state().get()); | 235 static_cast<internal::AudioState*>(helper.audio_state().get()); |
244 VoiceEngineObserver* voe_observer = | 236 VoiceEngineObserver* voe_observer = |
245 static_cast<VoiceEngineObserver*>(internal_audio_state); | 237 static_cast<VoiceEngineObserver*>(internal_audio_state); |
246 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); | 238 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); |
247 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); | 239 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); |
248 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); | 240 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); |
249 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); | 241 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); |
250 } | 242 } |
251 } // namespace test | 243 } // namespace test |
252 } // namespace webrtc | 244 } // namespace webrtc |
OLD | NEW |