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 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 audio_processing_stats_.echo_return_loss_enhancement.Set( | 210 audio_processing_stats_.echo_return_loss_enhancement.Set( |
211 kEchoReturnLossEnhancement, kEchoReturnLossEnhancement, | 211 kEchoReturnLossEnhancement, kEchoReturnLossEnhancement, |
212 kEchoReturnLossEnhancement, kEchoReturnLossEnhancement); | 212 kEchoReturnLossEnhancement, kEchoReturnLossEnhancement); |
213 audio_processing_stats_.delay_median = kEchoDelayMedian; | 213 audio_processing_stats_.delay_median = kEchoDelayMedian; |
214 audio_processing_stats_.delay_standard_deviation = kEchoDelayStdDev; | 214 audio_processing_stats_.delay_standard_deviation = kEchoDelayStdDev; |
215 | 215 |
216 EXPECT_CALL(audio_processing_, GetStatistics()) | 216 EXPECT_CALL(audio_processing_, GetStatistics()) |
217 .WillRepeatedly(Return(audio_processing_stats_)); | 217 .WillRepeatedly(Return(audio_processing_stats_)); |
218 } | 218 } |
219 | 219 |
| 220 void SyncWorkerQueue() { |
| 221 static const size_t kDefaultTimeoutMs = 150; |
| 222 rtc::Event event(false, false); |
| 223 worker_queue_.PostTask([this, &event] { event.Set(); }); |
| 224 EXPECT_TRUE(event.Wait(kDefaultTimeoutMs)); |
| 225 } |
| 226 |
220 private: | 227 private: |
221 SimulatedClock simulated_clock_; | 228 SimulatedClock simulated_clock_; |
222 testing::StrictMock<MockVoiceEngine> voice_engine_; | 229 testing::StrictMock<MockVoiceEngine> voice_engine_; |
223 rtc::scoped_refptr<AudioState> audio_state_; | 230 rtc::scoped_refptr<AudioState> audio_state_; |
224 AudioSendStream::Config stream_config_; | 231 AudioSendStream::Config stream_config_; |
225 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 232 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
226 testing::NiceMock<MockCongestionObserver> bitrate_observer_; | 233 testing::NiceMock<MockCongestionObserver> bitrate_observer_; |
227 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; | 234 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; |
228 MockAudioProcessing audio_processing_; | 235 MockAudioProcessing audio_processing_; |
229 AudioProcessing::AudioProcessingStatistics audio_processing_stats_; | 236 AudioProcessing::AudioProcessingStatistics audio_processing_stats_; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 419 } |
413 | 420 |
414 TEST(AudioSendStreamTest, DoesNotPassHigherBitrateThanMaxBitrate) { | 421 TEST(AudioSendStreamTest, DoesNotPassHigherBitrateThanMaxBitrate) { |
415 ConfigHelper helper; | 422 ConfigHelper helper; |
416 internal::AudioSendStream send_stream( | 423 internal::AudioSendStream send_stream( |
417 helper.config(), helper.audio_state(), helper.worker_queue(), | 424 helper.config(), helper.audio_state(), helper.worker_queue(), |
418 helper.packet_router(), helper.congestion_controller(), | 425 helper.packet_router(), helper.congestion_controller(), |
419 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); | 426 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); |
420 EXPECT_CALL(*helper.channel_proxy(), | 427 EXPECT_CALL(*helper.channel_proxy(), |
421 SetBitrate(helper.config().max_bitrate_bps, _)); | 428 SetBitrate(helper.config().max_bitrate_bps, _)); |
| 429 EXPECT_CALL(*helper.channel_proxy(), AdaptCodec()); |
422 send_stream.OnBitrateUpdated(helper.config().max_bitrate_bps + 5000, 0.0, 50, | 430 send_stream.OnBitrateUpdated(helper.config().max_bitrate_bps + 5000, 0.0, 50, |
423 6000); | 431 6000); |
| 432 helper.SyncWorkerQueue(); |
424 } | 433 } |
425 | 434 |
426 TEST(AudioSendStreamTest, ProbingIntervalOnBitrateUpdated) { | 435 TEST(AudioSendStreamTest, ProbingIntervalOnBitrateUpdated) { |
427 ConfigHelper helper; | 436 ConfigHelper helper; |
428 internal::AudioSendStream send_stream( | 437 internal::AudioSendStream send_stream( |
429 helper.config(), helper.audio_state(), helper.worker_queue(), | 438 helper.config(), helper.audio_state(), helper.worker_queue(), |
430 helper.packet_router(), helper.congestion_controller(), | 439 helper.packet_router(), helper.congestion_controller(), |
431 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); | 440 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); |
432 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000)); | 441 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000)); |
| 442 EXPECT_CALL(*helper.channel_proxy(), AdaptCodec()); |
433 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000); | 443 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000); |
| 444 helper.SyncWorkerQueue(); |
434 } | 445 } |
435 | 446 |
436 } // namespace test | 447 } // namespace test |
437 } // namespace webrtc | 448 } // namespace webrtc |
OLD | NEW |