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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/mimd_rate_control.cc

Issue 1151603008: Make the BWE threshold adaptive. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Improve self-fairness. Created 5 years, 6 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
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (now_ms - time_of_last_log_ > kLogIntervalMs) { 86 if (now_ms - time_of_last_log_ > kLogIntervalMs) {
87 time_of_last_log_ = now_ms; 87 time_of_last_log_ = now_ms;
88 } 88 }
89 return current_bit_rate_; 89 return current_bit_rate_;
90 } 90 }
91 91
92 void MimdRateControl::SetRtt(int64_t rtt) { 92 void MimdRateControl::SetRtt(int64_t rtt) {
93 rtt_ = rtt; 93 rtt_ = rtt;
94 } 94 }
95 95
96 RateControlRegion MimdRateControl::Update(const RateControlInput* input, 96 void MimdRateControl::Update(const RateControlInput* input, int64_t now_ms) {
97 int64_t now_ms) {
98 assert(input); 97 assert(input);
99 98
100 // Set the initial bit rate value to what we're receiving the first half 99 // Set the initial bit rate value to what we're receiving the first half
101 // second. 100 // second.
102 if (!initialized_bit_rate_) { 101 if (!initialized_bit_rate_) {
103 if (time_first_incoming_estimate_ < 0) { 102 if (time_first_incoming_estimate_ < 0) {
104 if (input->_incomingBitRate > 0) { 103 if (input->_incomingBitRate > 0) {
105 time_first_incoming_estimate_ = now_ms; 104 time_first_incoming_estimate_ = now_ms;
106 } 105 }
107 } else if (now_ms - time_first_incoming_estimate_ > 500 && 106 } else if (now_ms - time_first_incoming_estimate_ > 500 &&
108 input->_incomingBitRate > 0) { 107 input->_incomingBitRate > 0) {
109 current_bit_rate_ = input->_incomingBitRate; 108 current_bit_rate_ = input->_incomingBitRate;
110 initialized_bit_rate_ = true; 109 initialized_bit_rate_ = true;
111 } 110 }
112 } 111 }
113 112
114 if (updated_ && current_input_._bwState == kBwOverusing) { 113 if (updated_ && current_input_._bwState == kBwOverusing) {
115 // Only update delay factor and incoming bit rate. We always want to react 114 // Only update delay factor and incoming bit rate. We always want to react
116 // on an over-use. 115 // on an over-use.
117 current_input_._noiseVar = input->_noiseVar; 116 current_input_._noiseVar = input->_noiseVar;
118 current_input_._incomingBitRate = input->_incomingBitRate; 117 current_input_._incomingBitRate = input->_incomingBitRate;
119 return rate_control_region_; 118 return;
120 } 119 }
121 updated_ = true; 120 updated_ = true;
122 current_input_ = *input; 121 current_input_ = *input;
123 return rate_control_region_;
124 } 122 }
125 123
126 void MimdRateControl::SetEstimate(int bitrate_bps, int64_t now_ms) { 124 void MimdRateControl::SetEstimate(int bitrate_bps, int64_t now_ms) {
127 } 125 }
128 126
129 uint32_t MimdRateControl::ChangeBitRate(uint32_t current_bit_rate, 127 uint32_t MimdRateControl::ChangeBitRate(uint32_t current_bit_rate,
130 uint32_t incoming_bit_rate, 128 uint32_t incoming_bit_rate,
131 double noise_var, 129 double noise_var,
132 int64_t now_ms) { 130 int64_t now_ms) {
133 if (!updated_) { 131 if (!updated_) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 default: 317 default:
320 assert(false); 318 assert(false);
321 } 319 }
322 } 320 }
323 321
324 void MimdRateControl::ChangeState(RateControlState new_state) { 322 void MimdRateControl::ChangeState(RateControlState new_state) {
325 came_from_state_ = rate_control_state_; 323 came_from_state_ = rate_control_state_;
326 rate_control_state_ = new_state; 324 rate_control_state_ = new_state;
327 } 325 }
328 } // namespace webrtc 326 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698