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 24bfd78887d6d9a325aa62a29ce18e8796cd4739..94d8a34474cd7d74b5a1934c28e2393b981f8934 100644 |
| --- a/webrtc/modules/congestion_controller/congestion_controller.cc |
| +++ b/webrtc/modules/congestion_controller/congestion_controller.cc |
| @@ -22,6 +22,7 @@ |
| #include "webrtc/base/thread_annotations.h" |
| #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| #include "webrtc/modules/congestion_controller/delay_based_bwe.h" |
| +#include "webrtc/modules/congestion_controller/probe_controller.h" |
| #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" |
| #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h" |
| #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h" |
| @@ -166,13 +167,13 @@ CongestionController::CongestionController( |
| new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), |
| bitrate_controller_( |
| BitrateController::CreateBitrateController(clock_, event_log)), |
| + probe_controller_(new ProbeController(pacer_.get(), clock_)), |
| retransmission_rate_limiter_( |
| new RateLimiter(clock, kRetransmitWindowSizeMs)), |
| remote_estimator_proxy_(clock_, packet_router_.get()), |
| - transport_feedback_adapter_(bitrate_controller_.get(), clock_), |
| + transport_feedback_adapter_(clock_), |
| min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), |
| max_bitrate_bps_(0), |
| - initial_probing_triggered_(false), |
| last_reported_bitrate_bps_(0), |
| last_reported_fraction_loss_(0), |
| last_reported_rtt_(0), |
| @@ -197,13 +198,13 @@ CongestionController::CongestionController( |
| // construction. |
| bitrate_controller_( |
| BitrateController::CreateBitrateController(clock_, event_log)), |
| + probe_controller_(new ProbeController(pacer_.get(), clock_)), |
| retransmission_rate_limiter_( |
| new RateLimiter(clock, kRetransmitWindowSizeMs)), |
| remote_estimator_proxy_(clock_, packet_router_.get()), |
| - transport_feedback_adapter_(bitrate_controller_.get(), clock_), |
| + transport_feedback_adapter_(clock_), |
| min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), |
| max_bitrate_bps_(0), |
| - initial_probing_triggered_(false), |
| last_reported_bitrate_bps_(0), |
| last_reported_fraction_loss_(0), |
| last_reported_rtt_(0), |
| @@ -215,7 +216,7 @@ CongestionController::~CongestionController() {} |
| void CongestionController::Init() { |
| transport_feedback_adapter_.SetBitrateEstimator( |
| - new DelayBasedBwe(&transport_feedback_adapter_, clock_)); |
| + new DelayBasedBwe(this, clock_)); |
| transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( |
| min_bitrate_bps_); |
| } |
| @@ -228,25 +229,8 @@ void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| min_bitrate_bps, |
| max_bitrate_bps); |
| - { |
| - rtc::CritScope cs(&critsect_); |
| - if (!initial_probing_triggered_) { |
| - pacer_->CreateProbeCluster(start_bitrate_bps * 3, 6); |
| - pacer_->CreateProbeCluster(start_bitrate_bps * 6, 5); |
| - initial_probing_triggered_ = true; |
| - } |
| - |
| - // Only do probing if: |
| - // - we are mid-call, which we consider to be if |
| - // |last_reported_bitrate_bps_| != 0, and |
| - // - the current bitrate is lower than the new |max_bitrate_bps|, and |
| - // - we actually want to increase the |max_bitrate_bps_|. |
| - if (last_reported_bitrate_bps_ != 0 && |
| - last_reported_bitrate_bps_ < static_cast<uint32_t>(max_bitrate_bps) && |
| - max_bitrate_bps > max_bitrate_bps_) { |
| - pacer_->CreateProbeCluster(max_bitrate_bps, 5); |
| - } |
| - } |
| + probe_controller_->SetBitrates(min_bitrate_bps, start_bitrate_bps, |
| + max_bitrate_bps); |
| max_bitrate_bps_ = max_bitrate_bps; |
| if (remote_bitrate_estimator_) |
| @@ -272,8 +256,7 @@ void CongestionController::ResetBweAndBitrates(int bitrate_bps, |
| if (remote_bitrate_estimator_) |
| remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
| - RemoteBitrateEstimator* rbe = new DelayBasedBwe( |
| - &transport_feedback_adapter_, clock_); |
| + RemoteBitrateEstimator* rbe = new DelayBasedBwe(this, clock_); |
|
stefan-webrtc
2016/09/09 12:03:52
It's not clear to me why we pass in a CongestionCo
Irfan
2016/09/12 06:40:40
I have gone and ahead and taken your suggestion.
|
| transport_feedback_adapter_.SetBitrateEstimator(rbe); |
| rbe->SetMinBitrate(min_bitrate_bps); |
| // TODO(holmer): Trigger a new probe once mid-call probing is implemented. |
| @@ -332,6 +315,16 @@ void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) { |
| sent_packet.send_time_ms); |
| } |
| +void CongestionController::OnReceiveBitrateChanged( |
| + const std::vector<uint32_t>& ssrcs, |
| + uint32_t bitrate_bps) { |
| + bitrate_controller_->UpdateDelayBasedEstimate(bitrate_bps); |
| +} |
| + |
| +void CongestionController::OnProbeBitrate(uint32_t bitrate_bps) { |
| + bitrate_controller_->UpdateProbeBitrate(bitrate_bps); |
| +} |
| + |
| void CongestionController::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { |
| remote_bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
| transport_feedback_adapter_.OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
| @@ -361,6 +354,7 @@ void CongestionController::MaybeTriggerOnNetworkChanged() { |
| &bitrate_bps, &fraction_loss, &rtt); |
| if (estimate_changed) { |
| pacer_->SetEstimatedBitrate(bitrate_bps); |
| + probe_controller_->SetEstimatedBitrate(bitrate_bps); |
| retransmission_rate_limiter_->SetMaxRate(bitrate_bps); |
| } |