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 ae11d93fbbfb01ab512c16055bac6626a88397c4..c0ec3da0f9a42bca4b75d8e1a18d47c61659e08c 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(bitrate_controller_.get(), 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,8 @@ 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(bitrate_controller_.get(), clock_); |
transport_feedback_adapter_.SetBitrateEstimator(rbe); |
rbe->SetMinBitrate(min_bitrate_bps); |
// TODO(holmer): Trigger a new probe once mid-call probing is implemented. |
@@ -361,6 +345,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); |
} |