Chromium Code Reviews| Index: webrtc/modules/congestion_controller/congestion_controller.cc |
| diff --git a/webrtc/modules/congestion_controller/congestion_controller.cc b/webrtc/modules/congestion_controller/congestion_controller.cc |
| index 5767448a5f7bf711a24ef214ea47d5f5cac18f20..de36031e9da348aac434732925618aff7324b04c 100644 |
| --- a/webrtc/modules/congestion_controller/congestion_controller.cc |
| +++ b/webrtc/modules/congestion_controller/congestion_controller.cc |
| @@ -212,21 +212,25 @@ void CongestionController::Init() { |
| min_bitrate_bps_); |
| } |
| - |
| -void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| - int start_bitrate_bps, |
| - int max_bitrate_bps) { |
| +void CongestionController::ClampBitrates(int* bitrate_bps, |
|
stefan-webrtc
2016/05/30 06:47:03
Seems like this can be a static function within th
honghaiz3
2016/05/31 16:58:03
Done.
|
| + int* min_bitrate_bps, |
| + int* max_bitrate_bps) { |
| // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, |
| // and that we don't try to set the min bitrate to 0 from any applications. |
| // The congestion controller should allow a min bitrate of 0. |
| const int kMinBitrateBps = 10000; |
| - if (min_bitrate_bps < kMinBitrateBps) |
| - min_bitrate_bps = kMinBitrateBps; |
| - if (max_bitrate_bps > 0) |
| - max_bitrate_bps = std::max(min_bitrate_bps, max_bitrate_bps); |
| - if (start_bitrate_bps > 0) |
| - start_bitrate_bps = std::max(min_bitrate_bps, start_bitrate_bps); |
| + if (*min_bitrate_bps < kMinBitrateBps) |
| + *min_bitrate_bps = kMinBitrateBps; |
| + if (*max_bitrate_bps > 0) |
| + *max_bitrate_bps = std::max(*min_bitrate_bps, *max_bitrate_bps); |
| + if (*bitrate_bps > 0) |
| + *bitrate_bps = std::max(*min_bitrate_bps, *bitrate_bps); |
| +} |
| +void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| + int start_bitrate_bps, |
| + int max_bitrate_bps) { |
| + ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); |
| bitrate_controller_->SetBitrates(start_bitrate_bps, |
| min_bitrate_bps, |
| max_bitrate_bps); |
| @@ -239,6 +243,25 @@ void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| MaybeTriggerOnNetworkChanged(); |
| } |
| +void CongestionController::ResetBweBitrates(int bitrate_bps, |
|
stefan-webrtc
2016/05/30 06:47:03
ResetBitrates() or maybe ResetBwe() to make it cle
honghaiz3
2016/05/31 16:58:03
Based on your comments, will it be clearer to use
stefan-webrtc
2016/05/31 17:27:49
That works
|
| + int min_bitrate_bps, |
| + int max_bitrate_bps) { |
| + ClampBitrates(&bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); |
| + bitrate_controller_->ResetBitrates(bitrate_bps, min_bitrate_bps, |
| + max_bitrate_bps); |
| + min_bitrate_bps_ = min_bitrate_bps; |
| + if (remote_bitrate_estimator_) { |
|
stefan-webrtc
2016/05/30 06:47:03
Remove {}
honghaiz3
2016/05/31 16:58:03
Done.
|
| + remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
| + } |
| + |
| + RemoteBitrateEstimator* rbe = |
| + new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_); |
| + transport_feedback_adapter_.SetBitrateEstimator(rbe); |
|
stefan-webrtc
2016/05/30 06:47:03
Will the previous rbe be deleted?
honghaiz3
2016/05/31 16:58:03
Yes, the bitrate_estimator_ is a unique_ptr.
|
| + rbe->SetMinBitrate(min_bitrate_bps); |
| + |
|
stefan-webrtc
2016/05/30 06:47:03
Could you add a TODO which says "TODO(holmer): Tri
honghaiz3
2016/05/31 16:58:03
Done.
|
| + MaybeTriggerOnNetworkChanged(); |
| +} |
| + |
| BitrateController* CongestionController::GetBitrateController() const { |
| return bitrate_controller_.get(); |
| } |