From 0b97e177e1ad6b605831fbab830acb373d2678bb Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Tue, 28 May 2019 11:11:43 +0200 Subject: [PATCH] Cleanup of CongestionWindowDownlinkDelay trial. Bug: webrtc:9883 Change-Id: If77fdad610149c01d72891d4a9f61b61006b21ce Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138827 Reviewed-by: Ying Wang Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#28087} --- .../goog_cc/goog_cc_network_control.cc | 31 +++++++++---------- .../goog_cc/goog_cc_network_control.h | 3 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc index ea71a982b1..72f4048d3a 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc @@ -224,14 +224,10 @@ NetworkControlUpdate GoogCcNetworkController::OnProcessInterval( update.probe_cluster_configs.insert(update.probe_cluster_configs.end(), probes.begin(), probes.end()); - time_since_last_received_packet_ = - !last_packet_received_time_.IsMinusInfinity() && - use_downlink_delay_for_congestion_window_ - ? msg.at_time - last_packet_received_time_ - : TimeDelta::Zero(); if (rate_control_settings_.UseCongestionWindow() && - (time_since_last_received_packet_ > TimeDelta::Zero())) { - UpdateCongestionWindowSize(); + use_downlink_delay_for_congestion_window_ && + last_packet_received_time_.IsFinite() && !feedback_max_rtts_.empty()) { + UpdateCongestionWindowSize(msg.at_time - last_packet_received_time_); } MaybeTriggerOnNetworkChanged(&update, msg.at_time); return update; @@ -405,18 +401,21 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportLossReport( return NetworkControlUpdate(); } -void GoogCcNetworkController::UpdateCongestionWindowSize() { - if (feedback_max_rtts_.empty()) - return; - int64_t min_feedback_max_rtt_ms = - *std::min_element(feedback_max_rtts_.begin(), feedback_max_rtts_.end()); +void GoogCcNetworkController::UpdateCongestionWindowSize( + TimeDelta time_since_last_packet) { + TimeDelta min_feedback_max_rtt = TimeDelta::ms( + *std::min_element(feedback_max_rtts_.begin(), feedback_max_rtts_.end())); const DataSize kMinCwnd = DataSize::bytes(2 * 1500); TimeDelta time_window = + min_feedback_max_rtt + TimeDelta::ms( - min_feedback_max_rtt_ms + - rate_control_settings_.GetCongestionWindowAdditionalTimeMs()) + - time_since_last_received_packet_; + rate_control_settings_.GetCongestionWindowAdditionalTimeMs()); + + if (use_downlink_delay_for_congestion_window_) { + time_window += time_since_last_packet; + } + DataSize data_window = last_raw_target_rate_ * time_window; if (current_data_window_) { data_window = @@ -577,7 +576,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback( // we don't try to limit the outstanding packets. if (rate_control_settings_.UseCongestionWindow() && max_feedback_rtt.IsFinite()) { - UpdateCongestionWindowSize(); + UpdateCongestionWindowSize(/*time_since_last_packet*/ TimeDelta::Zero()); } if (congestion_window_pushback_controller_ && current_data_window_) { congestion_window_pushback_controller_->SetDataWindow( diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.h b/modules/congestion_controller/goog_cc/goog_cc_network_control.h index 8ac7341bd0..5314a57726 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control.h +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.h @@ -74,7 +74,7 @@ class GoogCcNetworkController : public NetworkControllerInterface { void ClampConstraints(); void MaybeTriggerOnNetworkChanged(NetworkControlUpdate* update, Timestamp at_time); - void UpdateCongestionWindowSize(); + void UpdateCongestionWindowSize(TimeDelta time_since_last_packet); PacerConfig GetPacingRates(Timestamp at_time) const; const FieldTrialBasedConfig trial_based_config_; @@ -123,7 +123,6 @@ class GoogCcNetworkController : public NetworkControllerInterface { uint8_t last_estimated_fraction_loss_ = 0; int64_t last_estimated_rtt_ms_ = 0; Timestamp last_packet_received_time_ = Timestamp::MinusInfinity(); - TimeDelta time_since_last_received_packet_ = TimeDelta::Zero(); double pacing_factor_; DataRate min_total_allocated_bitrate_;