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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 stream_config_.rtp.ssrc = kSsrc; | 98 stream_config_.rtp.ssrc = kSsrc; |
99 stream_config_.rtp.nack.rtp_history_ms = 200; | 99 stream_config_.rtp.nack.rtp_history_ms = 200; |
100 stream_config_.rtp.c_name = kCName; | 100 stream_config_.rtp.c_name = kCName; |
101 stream_config_.rtp.extensions.push_back( | 101 stream_config_.rtp.extensions.push_back( |
102 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); | 102 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); |
103 stream_config_.rtp.extensions.push_back(RtpExtension( | 103 stream_config_.rtp.extensions.push_back(RtpExtension( |
104 RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberId)); | 104 RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberId)); |
105 // Use ISAC as default codec so as to prevent unnecessary |voice_engine_| | 105 // Use ISAC as default codec so as to prevent unnecessary |voice_engine_| |
106 // calls from the default ctor behavior. | 106 // calls from the default ctor behavior. |
107 stream_config_.send_codec_spec.codec_inst = kIsacCodec; | 107 stream_config_.send_codec_spec.codec_inst = kIsacCodec; |
| 108 stream_config_.min_bitrate_bps = 10000; |
| 109 stream_config_.max_bitrate_bps = 65000; |
108 } | 110 } |
109 | 111 |
110 AudioSendStream::Config& config() { return stream_config_; } | 112 AudioSendStream::Config& config() { return stream_config_; } |
111 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } | 113 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } |
112 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } | 114 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } |
113 CongestionController* congestion_controller() { | 115 CongestionController* congestion_controller() { |
114 return &congestion_controller_; | 116 return &congestion_controller_; |
115 } | 117 } |
116 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } | 118 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } |
117 rtc::TaskQueue* worker_queue() { return &worker_queue_; } | 119 rtc::TaskQueue* worker_queue() { return &worker_queue_; } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 stream_config.send_codec_spec.cng_plfreq = 8000; | 395 stream_config.send_codec_spec.cng_plfreq = 8000; |
394 stream_config.send_codec_spec.cng_payload_type = 105; | 396 stream_config.send_codec_spec.cng_payload_type = 105; |
395 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) | 397 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) |
396 .WillOnce(Return(0)); | 398 .WillOnce(Return(0)); |
397 internal::AudioSendStream send_stream( | 399 internal::AudioSendStream send_stream( |
398 stream_config, helper.audio_state(), helper.worker_queue(), | 400 stream_config, helper.audio_state(), helper.worker_queue(), |
399 helper.congestion_controller(), helper.bitrate_allocator(), | 401 helper.congestion_controller(), helper.bitrate_allocator(), |
400 helper.event_log()); | 402 helper.event_log()); |
401 } | 403 } |
402 | 404 |
| 405 TEST(AudioSendStreamTest, DoesNotPassHigherBitrateThanMaxBitrate) { |
| 406 ConfigHelper helper; |
| 407 internal::AudioSendStream send_stream( |
| 408 helper.config(), helper.audio_state(), helper.worker_queue(), |
| 409 helper.congestion_controller(), helper.bitrate_allocator(), |
| 410 helper.event_log()); |
| 411 EXPECT_CALL(*helper.channel_proxy(), |
| 412 SetBitrate(helper.config().max_bitrate_bps, _)); |
| 413 send_stream.OnBitrateUpdated(helper.config().max_bitrate_bps + 5000, 0.0, 50, |
| 414 6000); |
| 415 } |
| 416 |
| 417 TEST(AudioSendStreamTest, ProbingIntervalOnBitrateUpdated) { |
| 418 ConfigHelper helper; |
| 419 internal::AudioSendStream send_stream( |
| 420 helper.config(), helper.audio_state(), helper.worker_queue(), |
| 421 helper.congestion_controller(), helper.bitrate_allocator(), |
| 422 helper.event_log()); |
| 423 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000)); |
| 424 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000); |
| 425 |
| 426 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 6000)); |
| 427 send_stream.OnBitrateUpdated(50000, 0.0, 50, 6000); |
| 428 } |
| 429 |
403 } // namespace test | 430 } // namespace test |
404 } // namespace webrtc | 431 } // namespace webrtc |
OLD | NEW |