Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1050)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h

Issue 2789233005: Move BWE period calculation from ProbingIntervalEstimator to AimdRateControl. (Closed)
Patch Set: Nits Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_
13 13
14 #include "webrtc/base/constructormagic.h" 14 #include "webrtc/base/constructormagic.h"
15 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" 15 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 18
19 // A rate control implementation based on additive increases of 19 // A rate control implementation based on additive increases of
20 // bitrate when no over-use is detected and multiplicative decreases when 20 // bitrate when no over-use is detected and multiplicative decreases when
21 // over-uses are detected. When we think the available bandwidth has changes or 21 // over-uses are detected. When we think the available bandwidth has changes or
22 // is unknown, we will switch to a "slow-start mode" where we increase 22 // is unknown, we will switch to a "slow-start mode" where we increase
23 // multiplicatively. 23 // multiplicatively.
24 class AimdRateControl { 24 class AimdRateControl {
25 public: 25 public:
26 AimdRateControl(); 26 AimdRateControl();
27 virtual ~AimdRateControl(); 27 ~AimdRateControl();
28 28
29 // Returns true if there is a valid estimate of the incoming bitrate, false 29 // Returns true if there is a valid estimate of the incoming bitrate, false
30 // otherwise. 30 // otherwise.
31 bool ValidEstimate() const; 31 bool ValidEstimate() const;
32 void SetStartBitrate(int start_bitrate_bps); 32 void SetStartBitrate(int start_bitrate_bps);
33 void SetMinBitrate(int min_bitrate_bps); 33 void SetMinBitrate(int min_bitrate_bps);
34 int64_t GetFeedbackInterval() const; 34 int64_t GetFeedbackInterval() const;
35 // Returns true if the bitrate estimate hasn't been changed for more than 35 // Returns true if the bitrate estimate hasn't been changed for more than
36 // an RTT, or if the incoming_bitrate is less than half of the current 36 // an RTT, or if the incoming_bitrate is less than half of the current
37 // estimate. Should be used to decide if we should reduce the rate further 37 // estimate. Should be used to decide if we should reduce the rate further
38 // when over-using. 38 // when over-using.
39 bool TimeToReduceFurther(int64_t time_now, 39 bool TimeToReduceFurther(int64_t time_now,
40 uint32_t incoming_bitrate_bps) const; 40 uint32_t incoming_bitrate_bps) const;
41 uint32_t LatestEstimate() const; 41 uint32_t LatestEstimate() const;
42 void SetRtt(int64_t rtt); 42 void SetRtt(int64_t rtt);
43 uint32_t Update(const RateControlInput* input, int64_t now_ms); 43 uint32_t 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 45
46 // Returns the increase rate which is used when used bandwidth is near the 46 // Returns the increase rate when used bandwidth is near the link capacity.
47 // maximal available bandwidth. 47 int GetNearMaxIncreaseRateBps() const;
48 virtual int GetNearMaxIncreaseRateBps() const; 48 // Returns the expected time between overuse signals (assuming steady state).
49 49 int GetExpectedBandwidthPeriodMs() const;
50 virtual rtc::Optional<int> GetLastBitrateDecreaseBps() const;
51 50
52 private: 51 private:
53 // Update the target bitrate according based on, among other things, 52 // Update the target bitrate according based on, among other things,
54 // the current rate control state, the current target bitrate and the incoming 53 // the current rate control state, the current target bitrate and the incoming
55 // bitrate. When in the "increase" state the bitrate will be increased either 54 // bitrate. When in the "increase" state the bitrate will be increased either
56 // additively or multiplicatively depending on the rate control region. When 55 // additively or multiplicatively depending on the rate control region. When
57 // in the "decrease" state the bitrate will be decreased to slightly below the 56 // in the "decrease" state the bitrate will be decreased to slightly below the
58 // incoming bitrate. When in the "hold" state the bitrate will be kept 57 // incoming bitrate. When in the "hold" state the bitrate will be kept
59 // constant to allow built up queues to drain. 58 // constant to allow built up queues to drain.
60 uint32_t ChangeBitrate(uint32_t current_bitrate, 59 uint32_t ChangeBitrate(uint32_t current_bitrate,
(...skipping 23 matching lines...) Expand all
84 int64_t time_first_incoming_estimate_; 83 int64_t time_first_incoming_estimate_;
85 bool bitrate_is_initialized_; 84 bool bitrate_is_initialized_;
86 float beta_; 85 float beta_;
87 int64_t rtt_; 86 int64_t rtt_;
88 bool in_experiment_; 87 bool in_experiment_;
89 rtc::Optional<int> last_decrease_; 88 rtc::Optional<int> last_decrease_;
90 }; 89 };
91 } // namespace webrtc 90 } // namespace webrtc
92 91
93 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ 92 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698