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

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: Remove unused include. 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 int GetNearMaxIncreaseRateBps() const;
michaelt 2017/04/05 07:06:02 Was the comment to obvious ?
terelius 2017/04/05 10:58:03 Initially I tried to remove the entire function an
michaelt 2017/04/05 07:06:02 This function could be made private, but I'm not s
stefan-webrtc 2017/04/05 07:20:42 I prefer making it private. There should be other
terelius 2017/04/05 10:58:03 In principle I agree, but as I don't see a clean w
47 // maximal available bandwidth. 47 // Returns the expected time until the next overuse (assuming steady state).
48 virtual int GetNearMaxIncreaseRateBps() const; 48 int GetExpectedBandwidthPeriodMs() const;
49
50 virtual rtc::Optional<int> GetLastBitrateDecreaseBps() const;
51 49
52 private: 50 private:
53 // Update the target bitrate according based on, among other things, 51 // Update the target bitrate according based on, among other things,
54 // the current rate control state, the current target bitrate and the incoming 52 // 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 53 // bitrate. When in the "increase" state the bitrate will be increased either
56 // additively or multiplicatively depending on the rate control region. When 54 // additively or multiplicatively depending on the rate control region. When
57 // in the "decrease" state the bitrate will be decreased to slightly below the 55 // 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 56 // incoming bitrate. When in the "hold" state the bitrate will be kept
59 // constant to allow built up queues to drain. 57 // constant to allow built up queues to drain.
60 uint32_t ChangeBitrate(uint32_t current_bitrate, 58 uint32_t ChangeBitrate(uint32_t current_bitrate,
(...skipping 23 matching lines...) Expand all
84 int64_t time_first_incoming_estimate_; 82 int64_t time_first_incoming_estimate_;
85 bool bitrate_is_initialized_; 83 bool bitrate_is_initialized_;
86 float beta_; 84 float beta_;
87 int64_t rtt_; 85 int64_t rtt_;
88 bool in_experiment_; 86 bool in_experiment_;
89 rtc::Optional<int> last_decrease_; 87 rtc::Optional<int> last_decrease_;
90 }; 88 };
91 } // namespace webrtc 89 } // namespace webrtc
92 90
93 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_ 91 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698