OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 max_bitrate_bps); | 141 max_bitrate_bps); |
142 } | 142 } |
143 MaybeTriggerOnNetworkChanged(); | 143 MaybeTriggerOnNetworkChanged(); |
144 } | 144 } |
145 | 145 |
146 void BitrateControllerImpl::ResetBitrates(int bitrate_bps, | 146 void BitrateControllerImpl::ResetBitrates(int bitrate_bps, |
147 int min_bitrate_bps, | 147 int min_bitrate_bps, |
148 int max_bitrate_bps) { | 148 int max_bitrate_bps) { |
149 { | 149 { |
150 rtc::CritScope cs(&critsect_); | 150 rtc::CritScope cs(&critsect_); |
151 if (bitrate_bps == -1) { | |
terelius
2016/07/05 13:55:36
If -1 has a special meaning, isn't there a risk to
stefan-webrtc
2016/07/07 11:50:46
Good point, the correct behavior is to change to t
| |
152 uint8_t loss; | |
153 int64_t rtt; | |
154 bandwidth_estimation_.CurrentEstimate(&bitrate_bps, &loss, &rtt); | |
155 } | |
151 bandwidth_estimation_ = SendSideBandwidthEstimation(event_log_); | 156 bandwidth_estimation_ = SendSideBandwidthEstimation(event_log_); |
152 bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps, | 157 bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps, |
153 max_bitrate_bps); | 158 max_bitrate_bps); |
154 } | 159 } |
155 MaybeTriggerOnNetworkChanged(); | 160 MaybeTriggerOnNetworkChanged(); |
156 } | 161 } |
157 | 162 |
158 void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) { | 163 void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) { |
159 { | 164 { |
160 rtc::CritScope cs(&critsect_); | 165 rtc::CritScope cs(&critsect_); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 263 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
259 if (bitrate > 0) { | 264 if (bitrate > 0) { |
260 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 265 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
261 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 266 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
262 *bandwidth = bitrate; | 267 *bandwidth = bitrate; |
263 return true; | 268 return true; |
264 } | 269 } |
265 return false; | 270 return false; |
266 } | 271 } |
267 } // namespace webrtc | 272 } // namespace webrtc |
OLD | NEW |