| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _)) | 147 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _)) |
| 148 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss), | 148 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss), |
| 149 SetArgReferee<1>(kEchoReturnLossEnhancement), | 149 SetArgReferee<1>(kEchoReturnLossEnhancement), |
| 150 Return(0))); | 150 Return(0))); |
| 151 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) | 151 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) |
| 152 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), | 152 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), |
| 153 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); | 153 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); |
| 154 } | 154 } |
| 155 | 155 |
| 156 private: | 156 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_; | 157 testing::StrictMock<MockVoiceEngine> voice_engine_; |
| 165 rtc::scoped_refptr<AudioState> audio_state_; | 158 rtc::scoped_refptr<AudioState> audio_state_; |
| 166 AudioSendStream::Config stream_config_; | 159 AudioSendStream::Config stream_config_; |
| 167 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 160 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
| 168 CallStats call_stats_; | 161 CallStats call_stats_; |
| 169 NullBitrateObserver bitrate_observer_; | 162 testing::NiceMock<MockBitrateObserver> bitrate_observer_; |
| 170 rtc::scoped_ptr<ProcessThread> process_thread_; | 163 rtc::scoped_ptr<ProcessThread> process_thread_; |
| 171 CongestionController congestion_controller_; | 164 CongestionController congestion_controller_; |
| 172 }; | 165 }; |
| 173 } // namespace | 166 } // namespace |
| 174 | 167 |
| 175 TEST(AudioSendStreamTest, ConfigToString) { | 168 TEST(AudioSendStreamTest, ConfigToString) { |
| 176 AudioSendStream::Config config(nullptr); | 169 AudioSendStream::Config config(nullptr); |
| 177 config.rtp.ssrc = kSsrc; | 170 config.rtp.ssrc = kSsrc; |
| 178 config.rtp.extensions.push_back( | 171 config.rtp.extensions.push_back( |
| 179 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); | 172 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()); | 236 static_cast<internal::AudioState*>(helper.audio_state().get()); |
| 244 VoiceEngineObserver* voe_observer = | 237 VoiceEngineObserver* voe_observer = |
| 245 static_cast<VoiceEngineObserver*>(internal_audio_state); | 238 static_cast<VoiceEngineObserver*>(internal_audio_state); |
| 246 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); | 239 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); |
| 247 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); | 240 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); |
| 248 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); | 241 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); |
| 249 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); | 242 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); |
| 250 } | 243 } |
| 251 } // namespace test | 244 } // namespace test |
| 252 } // namespace webrtc | 245 } // namespace webrtc |
| OLD | NEW |