Skip to content

Commit

Permalink
Add more options for tuning the RobustThroughputEstimator through fie…
Browse files Browse the repository at this point in the history
…ld trial.

Bug: webrtc:10274
Change-Id: I94a8c200947c66277d67812bc1d0acc9e1f40e7a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168045
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30432}
  • Loading branch information
Björn Terelius authored and Commit Bot committed Jan 30, 2020
1 parent fdbbada commit be99ee8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
Expand Up @@ -10,6 +10,8 @@

#include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.h"

#include <algorithm>

#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"
Expand All @@ -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<StructParametersParser>
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::
Expand Down
Expand Up @@ -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<StructParametersParser> Parser();
};

Expand Down
Expand Up @@ -53,7 +53,7 @@ void RobustThroughputEstimator::IncomingPacketFeedbackVector(
}

absl::optional<DataRate> 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));
Expand All @@ -80,7 +80,8 @@ absl::optional<DataRate> 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.
Expand Down

0 comments on commit be99ee8

Please sign in to comment.