Chromium Code Reviews| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 int max_bitrate_bps) { | 170 int max_bitrate_bps) { |
| 171 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, | 171 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, |
| 172 // and that we don't try to set the min bitrate to 0 from any applications. | 172 // and that we don't try to set the min bitrate to 0 from any applications. |
| 173 // The congestion controller should allow a min bitrate of 0. | 173 // The congestion controller should allow a min bitrate of 0. |
| 174 const int kMinBitrateBps = 10000; | 174 const int kMinBitrateBps = 10000; |
| 175 if (min_bitrate_bps < kMinBitrateBps) | 175 if (min_bitrate_bps < kMinBitrateBps) |
| 176 min_bitrate_bps = kMinBitrateBps; | 176 min_bitrate_bps = kMinBitrateBps; |
| 177 if (max_bitrate_bps > 0) | 177 if (max_bitrate_bps > 0) |
| 178 max_bitrate_bps = std::max(min_bitrate_bps, max_bitrate_bps); | 178 max_bitrate_bps = std::max(min_bitrate_bps, max_bitrate_bps); |
| 179 if (start_bitrate_bps > 0) { | 179 if (start_bitrate_bps > 0) { |
| 180 start_bitrate_bps = std::max(min_bitrate_bps, start_bitrate_bps); | 180 start_bitrate_bps = std::max(min_bitrate_bps, start_bitrate_bps); |
|
pbos-webrtc
2016/04/25 15:25:26
I think this std::max should be done inside SetMin
philipel
2016/04/25 15:53:01
The constraint is that min <= start <= max, so if
| |
| 181 bitrate_controller_->SetStartBitrate(start_bitrate_bps); | 181 bitrate_controller_->SetMinMaxStartBitrate(start_bitrate_bps, |
|
stefan-webrtc
2016/04/26 11:10:43
Allow start_bitrate_bps = -1 to mean "don't change
philipel
2016/04/28 10:42:57
Done.
| |
| 182 min_bitrate_bps, | |
| 183 max_bitrate_bps); | |
| 184 } else { | |
| 185 bitrate_controller_->SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps); | |
| 182 } | 186 } |
| 183 bitrate_controller_->SetMinMaxBitrate(min_bitrate_bps, max_bitrate_bps); | |
| 184 if (remote_bitrate_estimator_) | 187 if (remote_bitrate_estimator_) |
| 185 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); | 188 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
| 186 min_bitrate_bps_ = min_bitrate_bps; | 189 min_bitrate_bps_ = min_bitrate_bps; |
| 187 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( | 190 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( |
| 188 min_bitrate_bps_); | 191 min_bitrate_bps_); |
| 189 } | 192 } |
| 190 | 193 |
| 191 BitrateController* CongestionController::GetBitrateController() const { | 194 BitrateController* CongestionController::GetBitrateController() const { |
| 192 return bitrate_controller_.get(); | 195 return bitrate_controller_.get(); |
| 193 } | 196 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 return std::min(bitrate_controller_->TimeUntilNextProcess(), | 241 return std::min(bitrate_controller_->TimeUntilNextProcess(), |
| 239 remote_bitrate_estimator_->TimeUntilNextProcess()); | 242 remote_bitrate_estimator_->TimeUntilNextProcess()); |
| 240 } | 243 } |
| 241 | 244 |
| 242 void CongestionController::Process() { | 245 void CongestionController::Process() { |
| 243 bitrate_controller_->Process(); | 246 bitrate_controller_->Process(); |
| 244 remote_bitrate_estimator_->Process(); | 247 remote_bitrate_estimator_->Process(); |
| 245 } | 248 } |
| 246 | 249 |
| 247 } // namespace webrtc | 250 } // namespace webrtc |
| OLD | NEW |