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..aaef78338680da29cadd4e1f11e6097401876c7c 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_); |
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,14 @@ void CongestionController::OnSentPacket(const rtc::SentPacket& sent_packet) { |
sent_packet.send_time_ms); |
} |
+void CongestionController::OnDelayBasedBweChanged(int bitrate_bps) { |
philipel
2016/09/08 12:52:46
Where can I find the changes to the .h file?
Irfan
2016/09/09 08:12:52
The .h file is part of this patchset, its in inclu
philipel
2016/09/09 08:59:08
Oops
|
+ bitrate_controller_->UpdateDelayBasedEstimate(bitrate_bps); |
+} |
+ |
+void CongestionController::OnProbeBitrate(int 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); |
@@ -345,6 +336,7 @@ int64_t CongestionController::TimeUntilNextProcess() { |
void CongestionController::Process() { |
bitrate_controller_->Process(); |
remote_bitrate_estimator_->Process(); |
+ probe_controller_->Process(); |
MaybeTriggerOnNetworkChanged(); |
} |
@@ -361,6 +353,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); |
} |