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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 virtual rtc::Optional<int> GetLastBitrateDecreaseBps() const; | 51 virtual rtc::Optional<int> GetLastBitrateDecreaseBps() const; |
52 | 52 |
53 private: | 53 private: |
54 // Update the target bitrate according based on, among other things, | 54 // Update the target bitrate according based on, among other things, |
55 // the current rate control state, the current target bitrate and the incoming | 55 // the current rate control state, the current target bitrate and the incoming |
56 // bitrate. When in the "increase" state the bitrate will be increased either | 56 // bitrate. When in the "increase" state the bitrate will be increased either |
57 // additively or multiplicatively depending on the rate control region. When | 57 // additively or multiplicatively depending on the rate control region. When |
58 // in the "decrease" state the bitrate will be decreased to slightly below the | 58 // in the "decrease" state the bitrate will be decreased to slightly below the |
59 // incoming bitrate. When in the "hold" state the bitrate will be kept | 59 // incoming bitrate. When in the "hold" state the bitrate will be kept |
60 // constant to allow built up queues to drain. | 60 // constant to allow built up queues to drain. |
61 uint32_t ChangeBitrate(uint32_t current_bit_rate, | 61 uint32_t ChangeBitrate(uint32_t current_bitrate, |
62 uint32_t incoming_bit_rate, | 62 uint32_t incoming_bitrate, |
63 int64_t now_ms); | 63 int64_t now_ms); |
| 64 // Clamps new_bitrate_bps to within the configured min bitrate and a linear |
| 65 // function of the incoming bitrate, so that the new bitrate can't grow too |
| 66 // large compared to the bitrate actually being received by the other end. |
| 67 uint32_t ClampBitrate(uint32_t new_bitrate_bps, |
| 68 uint32_t incoming_bitrate_bps) const; |
64 uint32_t MultiplicativeRateIncrease(int64_t now_ms, int64_t last_ms, | 69 uint32_t MultiplicativeRateIncrease(int64_t now_ms, int64_t last_ms, |
65 uint32_t current_bitrate_bps) const; | 70 uint32_t current_bitrate_bps) const; |
66 uint32_t AdditiveRateIncrease(int64_t now_ms, int64_t last_ms) const; | 71 uint32_t AdditiveRateIncrease(int64_t now_ms, int64_t last_ms) const; |
67 void UpdateChangePeriod(int64_t now_ms); | 72 void UpdateChangePeriod(int64_t now_ms); |
68 void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps); | 73 void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps); |
69 void ChangeState(const RateControlInput& input, int64_t now_ms); | 74 void ChangeState(const RateControlInput& input, int64_t now_ms); |
70 void ChangeState(RateControlState new_state); | 75 void ChangeState(RateControlState new_state); |
71 void ChangeRegion(RateControlRegion region); | 76 void ChangeRegion(RateControlRegion region); |
72 | 77 |
73 uint32_t min_configured_bitrate_bps_; | 78 uint32_t min_configured_bitrate_bps_; |
74 uint32_t max_configured_bitrate_bps_; | 79 uint32_t max_configured_bitrate_bps_; |
75 uint32_t current_bitrate_bps_; | 80 uint32_t current_bitrate_bps_; |
76 float avg_max_bitrate_kbps_; | 81 float avg_max_bitrate_kbps_; |
77 float var_max_bitrate_kbps_; | 82 float var_max_bitrate_kbps_; |
78 RateControlState rate_control_state_; | 83 RateControlState rate_control_state_; |
79 RateControlRegion rate_control_region_; | 84 RateControlRegion rate_control_region_; |
80 int64_t time_last_bitrate_change_; | 85 int64_t time_last_bitrate_change_; |
81 RateControlInput current_input_; | 86 RateControlInput current_input_; |
82 bool updated_; | 87 bool updated_; |
83 int64_t time_first_incoming_estimate_; | 88 int64_t time_first_incoming_estimate_; |
84 bool bitrate_is_initialized_; | 89 bool bitrate_is_initialized_; |
85 float beta_; | 90 float beta_; |
86 int64_t rtt_; | 91 int64_t rtt_; |
87 bool in_experiment_; | 92 bool in_experiment_; |
88 rtc::Optional<int> last_decrease_; | 93 rtc::Optional<int> last_decrease_; |
89 }; | 94 }; |
90 } // namespace webrtc | 95 } // namespace webrtc |
91 | 96 |
92 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ | 97 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ |
OLD | NEW |