From be99ee8f17f93e06c81e3deb4897dfa8253d3211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Terelius?= Date: Thu, 30 Jan 2020 19:24:48 +0100 Subject: [PATCH] Add more options for tuning the RobustThroughputEstimator through field trial. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:10274 Change-Id: I94a8c200947c66277d67812bc1d0acc9e1f40e7a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168045 Commit-Queue: Björn Terelius Reviewed-by: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#30432} --- ...cknowledged_bitrate_estimator_interface.cc | 27 ++++++++++++++----- ...acknowledged_bitrate_estimator_interface.h | 9 +++++++ .../goog_cc/robust_throughput_estimator.cc | 5 ++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.cc b/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.cc index e86ab63d50..8abe6d6884 100644 --- a/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.cc +++ b/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.cc @@ -10,6 +10,8 @@ #include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.h" +#include + #include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator.h" #include "modules/congestion_controller/goog_cc/robust_throughput_estimator.h" #include "rtc_base/logging.h" @@ -27,21 +29,34 @@ RobustThroughputEstimatorSettings::RobustThroughputEstimatorSettings( << " packets"; min_packets = 20; } + if (initial_packets < 10 || kMaxPackets < initial_packets) { + RTC_LOG(LS_WARNING) << "Initial size must be between 10 and " << kMaxPackets + << " packets"; + initial_packets = 20; + } + initial_packets = std::min(initial_packets, min_packets); if (window_duration < TimeDelta::ms(100) || TimeDelta::ms(2000) < window_duration) { RTC_LOG(LS_WARNING) << "Window duration must be between 100 and 2000 ms"; window_duration = TimeDelta::ms(500); } + if (unacked_weight < 0.0 || 1.0 < unacked_weight) { + RTC_LOG(LS_WARNING) + << "Weight for prior unacked size must be between 0 and 1."; + unacked_weight = 1.0; + } } std::unique_ptr RobustThroughputEstimatorSettings::Parser() { - return StructParametersParser::Create("enabled", &enabled, // - "reduce_bias", &reduce_bias, // - "assume_shared_link", - &assume_shared_link, // - "min_packets", &min_packets, // - "window_duration", &window_duration); + return StructParametersParser::Create("enabled", &enabled, // + "reduce_bias", &reduce_bias, // + "assume_shared_link", // + &assume_shared_link, // + "min_packets", &min_packets, // + "window_duration", &window_duration, // + "initial_packets", &initial_packets, // + "unacked_weight", &unacked_weight); } AcknowledgedBitrateEstimatorInterface:: diff --git a/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.h b/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.h index 0b29a2c71a..fb257cf3f4 100644 --- a/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.h +++ b/modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.h @@ -49,6 +49,15 @@ struct RobustThroughputEstimatorSettings { unsigned min_packets = 20; TimeDelta window_duration = TimeDelta::ms(500); + // The estimator window requires at least |initial_packets| packets received + // over at least |initial_duration|. + unsigned initial_packets = 20; + + // If audio packets are included in allocation, but not in bandwidth + // estimation and the sent audio packets get double counted, + // then it might be useful to reduce the weight to 0.5. + double unacked_weight = 1.0; + std::unique_ptr Parser(); }; diff --git a/modules/congestion_controller/goog_cc/robust_throughput_estimator.cc b/modules/congestion_controller/goog_cc/robust_throughput_estimator.cc index 5966bc0a7e..8c77e8ff31 100644 --- a/modules/congestion_controller/goog_cc/robust_throughput_estimator.cc +++ b/modules/congestion_controller/goog_cc/robust_throughput_estimator.cc @@ -53,7 +53,7 @@ void RobustThroughputEstimator::IncomingPacketFeedbackVector( } absl::optional RobustThroughputEstimator::bitrate() const { - if (window_.size() < settings_.min_packets) + if (window_.size() < settings_.initial_packets) return absl::nullopt; TimeDelta largest_recv_gap(TimeDelta::ms(0)); @@ -80,7 +80,8 @@ absl::optional RobustThroughputEstimator::bitrate() const { min_recv_time = std::min(min_recv_time, packet.receive_time); max_recv_time = std::max(max_recv_time, packet.receive_time); data_size += packet.sent_packet.size; - data_size += packet.sent_packet.prior_unacked_data; + data_size += + packet.sent_packet.prior_unacked_data * settings_.unacked_weight; } // Suppose a packet of size S is sent every T milliseconds.