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 24 matching lines...) Expand all Loading... | |
35 // an RTT, or if the incoming_bitrate is more than 5% above the current | 35 // an RTT, or if the incoming_bitrate is more than 5% above the current |
36 // estimate. Should be used to decide if we should reduce the rate further | 36 // estimate. Should be used to decide if we should reduce the rate further |
37 // when over-using. | 37 // when over-using. |
38 bool TimeToReduceFurther(int64_t time_now, | 38 bool TimeToReduceFurther(int64_t time_now, |
39 uint32_t incoming_bitrate_bps) const; | 39 uint32_t incoming_bitrate_bps) const; |
40 uint32_t LatestEstimate() const; | 40 uint32_t LatestEstimate() const; |
41 uint32_t UpdateBandwidthEstimate(int64_t now_ms); | 41 uint32_t UpdateBandwidthEstimate(int64_t now_ms); |
42 void SetRtt(int64_t rtt); | 42 void SetRtt(int64_t rtt); |
43 void Update(const RateControlInput* input, int64_t now_ms); | 43 void Update(const RateControlInput* input, int64_t now_ms); |
44 void SetEstimate(int bitrate_bps, int64_t now_ms); | 44 void SetEstimate(int bitrate_bps, int64_t now_ms); |
45 virtual int GetNearMaxIncreaseRateBps() const; | |
minyue-webrtc
2016/11/14 16:50:42
why virtual?
Does "Near" mean "Latest"? I feel th
michaelt
2016/11/15 09:41:59
The function is virtual so that I can mock them.
minyue-webrtc
2016/11/15 12:20:35
ah, right.
| |
46 virtual rtc::Optional<int> GetLastDecrease() const; | |
minyue-webrtc
2016/11/14 16:50:42
why virtual?
and the name may be made clearer: ho
michaelt
2016/11/15 09:41:59
The function is virtual so that I can mock them.
minyue-webrtc
2016/11/15 12:20:35
Acknowledged.
| |
45 | 47 |
46 private: | 48 private: |
47 // Update the target bitrate according based on, among other things, | 49 // Update the target bitrate according based on, among other things, |
48 // the current rate control state, the current target bitrate and the incoming | 50 // the current rate control state, the current target bitrate and the incoming |
49 // bitrate. When in the "increase" state the bitrate will be increased either | 51 // bitrate. When in the "increase" state the bitrate will be increased either |
50 // additively or multiplicatively depending on the rate control region. When | 52 // additively or multiplicatively depending on the rate control region. When |
51 // in the "decrease" state the bitrate will be decreased to slightly below the | 53 // in the "decrease" state the bitrate will be decreased to slightly below the |
52 // incoming bitrate. When in the "hold" state the bitrate will be kept | 54 // incoming bitrate. When in the "hold" state the bitrate will be kept |
53 // constant to allow built up queues to drain. | 55 // constant to allow built up queues to drain. |
54 uint32_t ChangeBitrate(uint32_t current_bit_rate, | 56 uint32_t ChangeBitrate(uint32_t current_bit_rate, |
55 uint32_t incoming_bit_rate, | 57 uint32_t incoming_bit_rate, |
56 int64_t now_ms); | 58 int64_t now_ms); |
57 uint32_t MultiplicativeRateIncrease(int64_t now_ms, int64_t last_ms, | 59 uint32_t MultiplicativeRateIncrease(int64_t now_ms, int64_t last_ms, |
58 uint32_t current_bitrate_bps) const; | 60 uint32_t current_bitrate_bps) const; |
59 uint32_t AdditiveRateIncrease(int64_t now_ms, int64_t last_ms, | 61 uint32_t AdditiveRateIncrease(int64_t now_ms, int64_t last_ms) const; |
60 int64_t response_time_ms) const; | |
61 void UpdateChangePeriod(int64_t now_ms); | 62 void UpdateChangePeriod(int64_t now_ms); |
62 void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps); | 63 void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps); |
63 void ChangeState(const RateControlInput& input, int64_t now_ms); | 64 void ChangeState(const RateControlInput& input, int64_t now_ms); |
64 void ChangeState(RateControlState new_state); | 65 void ChangeState(RateControlState new_state); |
65 void ChangeRegion(RateControlRegion region); | 66 void ChangeRegion(RateControlRegion region); |
66 | 67 |
67 uint32_t min_configured_bitrate_bps_; | 68 uint32_t min_configured_bitrate_bps_; |
68 uint32_t max_configured_bitrate_bps_; | 69 uint32_t max_configured_bitrate_bps_; |
69 uint32_t current_bitrate_bps_; | 70 uint32_t current_bitrate_bps_; |
70 float avg_max_bitrate_kbps_; | 71 float avg_max_bitrate_kbps_; |
71 float var_max_bitrate_kbps_; | 72 float var_max_bitrate_kbps_; |
72 RateControlState rate_control_state_; | 73 RateControlState rate_control_state_; |
73 RateControlRegion rate_control_region_; | 74 RateControlRegion rate_control_region_; |
74 int64_t time_last_bitrate_change_; | 75 int64_t time_last_bitrate_change_; |
75 RateControlInput current_input_; | 76 RateControlInput current_input_; |
76 bool updated_; | 77 bool updated_; |
77 int64_t time_first_incoming_estimate_; | 78 int64_t time_first_incoming_estimate_; |
78 bool bitrate_is_initialized_; | 79 bool bitrate_is_initialized_; |
79 float beta_; | 80 float beta_; |
80 int64_t rtt_; | 81 int64_t rtt_; |
81 bool in_experiment_; | 82 bool in_experiment_; |
83 rtc::Optional<int> last_decrease_; | |
82 }; | 84 }; |
83 } // namespace webrtc | 85 } // namespace webrtc |
84 | 86 |
85 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ | 87 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ |
OLD | NEW |