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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 int max_bitrate_bps) { | 131 int max_bitrate_bps) { |
132 { | 132 { |
133 rtc::CritScope cs(&critsect_); | 133 rtc::CritScope cs(&critsect_); |
134 bandwidth_estimation_.SetBitrates(start_bitrate_bps, | 134 bandwidth_estimation_.SetBitrates(start_bitrate_bps, |
135 min_bitrate_bps, | 135 min_bitrate_bps, |
136 max_bitrate_bps); | 136 max_bitrate_bps); |
137 } | 137 } |
138 MaybeTriggerOnNetworkChanged(); | 138 MaybeTriggerOnNetworkChanged(); |
139 } | 139 } |
140 | 140 |
| 141 void BitrateControllerImpl::ResetBitrates(int bitrate_bps, |
| 142 int min_bitrate_bps, |
| 143 int max_bitrate_bps) { |
| 144 { |
| 145 rtc::CritScope cs(&critsect_); |
| 146 bandwidth_estimation_ = SendSideBandwidthEstimation(); |
| 147 bandwidth_estimation_.SetBitrates(bitrate_bps, min_bitrate_bps, |
| 148 max_bitrate_bps); |
| 149 } |
| 150 MaybeTriggerOnNetworkChanged(); |
| 151 } |
| 152 |
141 void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) { | 153 void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) { |
142 { | 154 { |
143 rtc::CritScope cs(&critsect_); | 155 rtc::CritScope cs(&critsect_); |
144 reserved_bitrate_bps_ = reserved_bitrate_bps; | 156 reserved_bitrate_bps_ = reserved_bitrate_bps; |
145 } | 157 } |
146 MaybeTriggerOnNetworkChanged(); | 158 MaybeTriggerOnNetworkChanged(); |
147 } | 159 } |
148 | 160 |
149 void BitrateControllerImpl::SetEventLog(RtcEventLog* event_log) { | 161 void BitrateControllerImpl::SetEventLog(RtcEventLog* event_log) { |
150 rtc::CritScope cs(&critsect_); | 162 rtc::CritScope cs(&critsect_); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 258 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
247 if (bitrate > 0) { | 259 if (bitrate > 0) { |
248 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 260 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
249 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 261 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
250 *bandwidth = bitrate; | 262 *bandwidth = bitrate; |
251 return true; | 263 return true; |
252 } | 264 } |
253 return false; | 265 return false; |
254 } | 266 } |
255 } // namespace webrtc | 267 } // namespace webrtc |
OLD | NEW |