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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 | 205 |
| 206 CongestionController::~CongestionController() {} | 206 CongestionController::~CongestionController() {} |
| 207 | 207 |
| 208 void CongestionController::Init() { | 208 void CongestionController::Init() { |
| 209 transport_feedback_adapter_.SetBitrateEstimator( | 209 transport_feedback_adapter_.SetBitrateEstimator( |
| 210 new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_)); | 210 new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_)); |
| 211 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( | 211 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( |
| 212 min_bitrate_bps_); | 212 min_bitrate_bps_); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void CongestionController::FixBitrates(int* bitrate_bps, | |
|
stefan-webrtc
2016/05/27 21:46:15
ClampBitrates
honghaiz3
2016/05/27 23:20:44
Done.
| |
| 216 int* min_bitrate_bps, | |
| 217 int* max_bitrate_bps) { | |
| 218 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, | |
| 219 // and that we don't try to set the min bitrate to 0 from any applications. | |
| 220 // The congestion controller should allow a min bitrate of 0. | |
| 221 const int kMinBitrateBps = 10000; | |
| 222 if (*min_bitrate_bps < kMinBitrateBps) | |
| 223 *min_bitrate_bps = kMinBitrateBps; | |
| 224 if (*max_bitrate_bps > 0) | |
| 225 *max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps); | |
| 226 if (*bitrate_bps > 0) | |
| 227 *bitrate_bps = std::max(*min_bitrate_bps, *bitrate_bps); | |
| 228 } | |
| 215 | 229 |
| 216 void CongestionController::SetBweBitrates(int min_bitrate_bps, | 230 void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| 217 int start_bitrate_bps, | 231 int start_bitrate_bps, |
| 218 int max_bitrate_bps) { | 232 int max_bitrate_bps) { |
| 219 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, | 233 FixBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); |
| 220 // and that we don't try to set the min bitrate to 0 from any applications. | |
| 221 // The congestion controller should allow a min bitrate of 0. | |
| 222 const int kMinBitrateBps = 10000; | |
| 223 if (min_bitrate_bps < kMinBitrateBps) | |
| 224 min_bitrate_bps = kMinBitrateBps; | |
| 225 if (max_bitrate_bps > 0) | |
| 226 max_bitrate_bps = std::max(min_bitrate_bps, max_bitrate_bps); | |
| 227 if (start_bitrate_bps > 0) | |
| 228 start_bitrate_bps = std::max(min_bitrate_bps, start_bitrate_bps); | |
| 229 | |
| 230 bitrate_controller_->SetBitrates(start_bitrate_bps, | 234 bitrate_controller_->SetBitrates(start_bitrate_bps, |
| 231 min_bitrate_bps, | 235 min_bitrate_bps, |
| 232 max_bitrate_bps); | 236 max_bitrate_bps); |
| 233 | 237 |
| 234 if (remote_bitrate_estimator_) | 238 if (remote_bitrate_estimator_) |
| 235 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); | 239 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
| 236 min_bitrate_bps_ = min_bitrate_bps; | 240 min_bitrate_bps_ = min_bitrate_bps; |
| 237 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( | 241 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( |
| 238 min_bitrate_bps_); | 242 min_bitrate_bps_); |
| 239 MaybeTriggerOnNetworkChanged(); | 243 MaybeTriggerOnNetworkChanged(); |
| 240 } | 244 } |
| 241 | 245 |
| 246 void CongestionController::ResetBweBitrates(int bitrate_bps, | |
|
stefan-webrtc
2016/05/27 21:46:15
Is this called only on the send-side, or both send
honghaiz3
2016/05/27 23:20:44
Are we using the send-side BWE? Do we still need t
stefan-webrtc
2016/05/30 06:47:03
Receive-side BWE may still be negotiated instead o
honghaiz3
2016/06/01 16:54:10
Acknowledged.
| |
| 247 int min_bitrate_bps, | |
| 248 int max_bitrate_bps) { | |
| 249 FixBitrates(&bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); | |
| 250 bitrate_controller_->ResetBitrates(bitrate_bps, min_bitrate_bps, | |
|
stefan-webrtc
2016/05/27 21:46:15
Seems incorrect to me that we don't also reset tra
honghaiz3
2016/05/27 23:20:44
Done.
| |
| 251 max_bitrate_bps); | |
| 252 MaybeTriggerOnNetworkChanged(); | |
| 253 } | |
| 254 | |
| 242 BitrateController* CongestionController::GetBitrateController() const { | 255 BitrateController* CongestionController::GetBitrateController() const { |
| 243 return bitrate_controller_.get(); | 256 return bitrate_controller_.get(); |
| 244 } | 257 } |
| 245 | 258 |
| 246 RemoteBitrateEstimator* CongestionController::GetRemoteBitrateEstimator( | 259 RemoteBitrateEstimator* CongestionController::GetRemoteBitrateEstimator( |
| 247 bool send_side_bwe) { | 260 bool send_side_bwe) { |
| 248 if (send_side_bwe) { | 261 if (send_side_bwe) { |
| 249 return &remote_estimator_proxy_; | 262 return &remote_estimator_proxy_; |
| 250 } else { | 263 } else { |
| 251 return remote_bitrate_estimator_.get(); | 264 return remote_bitrate_estimator_.get(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 bool CongestionController::IsSendQueueFull() const { | 352 bool CongestionController::IsSendQueueFull() const { |
| 340 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 353 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
| 341 } | 354 } |
| 342 | 355 |
| 343 bool CongestionController::IsNetworkDown() const { | 356 bool CongestionController::IsNetworkDown() const { |
| 344 rtc::CritScope cs(&critsect_); | 357 rtc::CritScope cs(&critsect_); |
| 345 return network_state_ == kNetworkDown; | 358 return network_state_ == kNetworkDown; |
| 346 } | 359 } |
| 347 | 360 |
| 348 } // namespace webrtc | 361 } // namespace webrtc |
| OLD | NEW |