OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 return ClampBitrate(new_bitrate_bps, incoming_bitrate_bps); | 240 return ClampBitrate(new_bitrate_bps, incoming_bitrate_bps); |
241 } | 241 } |
242 | 242 |
243 uint32_t AimdRateControl::ClampBitrate(uint32_t new_bitrate_bps, | 243 uint32_t AimdRateControl::ClampBitrate(uint32_t new_bitrate_bps, |
244 uint32_t incoming_bitrate_bps) const { | 244 uint32_t incoming_bitrate_bps) const { |
245 // Don't change the bit rate if the send side is too far off. | 245 // Don't change the bit rate if the send side is too far off. |
246 // We allow a bit more lag at very low rates to not too easily get stuck if | 246 // We allow a bit more lag at very low rates to not too easily get stuck if |
247 // the encoder produces uneven outputs. | 247 // the encoder produces uneven outputs. |
248 const uint32_t max_bitrate_bps = | 248 const uint32_t max_bitrate_bps = |
249 static_cast<uint32_t>(1.5f * incoming_bitrate_bps) + 10000; | 249 static_cast<uint32_t>(1.2f * incoming_bitrate_bps) + 10000; |
250 if (new_bitrate_bps > current_bitrate_bps_ && | 250 if (new_bitrate_bps > current_bitrate_bps_ && |
251 new_bitrate_bps > max_bitrate_bps) { | 251 new_bitrate_bps > max_bitrate_bps) { |
252 new_bitrate_bps = std::max(current_bitrate_bps_, max_bitrate_bps); | 252 new_bitrate_bps = std::max(current_bitrate_bps_, max_bitrate_bps); |
253 } | 253 } |
254 new_bitrate_bps = std::max(new_bitrate_bps, min_configured_bitrate_bps_); | 254 new_bitrate_bps = std::max(new_bitrate_bps, min_configured_bitrate_bps_); |
255 return new_bitrate_bps; | 255 return new_bitrate_bps; |
256 } | 256 } |
257 | 257 |
258 uint32_t AimdRateControl::MultiplicativeRateIncrease( | 258 uint32_t AimdRateControl::MultiplicativeRateIncrease( |
259 int64_t now_ms, int64_t last_ms, uint32_t current_bitrate_bps) const { | 259 int64_t now_ms, int64_t last_ms, uint32_t current_bitrate_bps) const { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 default: | 318 default: |
319 assert(false); | 319 assert(false); |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 void AimdRateControl::ChangeRegion(RateControlRegion region) { | 323 void AimdRateControl::ChangeRegion(RateControlRegion region) { |
324 rate_control_region_ = region; | 324 rate_control_region_ = region; |
325 } | 325 } |
326 | 326 |
327 } // namespace webrtc | 327 } // namespace webrtc |
OLD | NEW |