mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Bound loss based estimate by upper link capacity when bandwidth is loss limited.
Motivation: loss based ramp-up can be incorrect when (1) bandwidth is loss limited, and (2) delay based estimate might be incorrect due to no delay signals. Therefore, bounding the loss based estimate by the delay based estimate is not much helpful in those cases. Thus strengthening the bounding logic by using upper link capacity is one of solutions to avoid incorrect ramp-up. Without the change: screen/qmLedxapJWvUTmn With the change: screen/8sQcksWa6CptywK Bug: webrtc:12707 Change-Id: I32ba82693b3ffa83cbb89c2cc9690fe16fb10c78 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283085 Commit-Queue: Diep Bui <diepbp@webrtc.org> Reviewed-by: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38626}
This commit is contained in:
parent
9b68e35baa
commit
7d8d64323c
6 changed files with 307 additions and 86 deletions
|
@ -543,7 +543,8 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
|
|||
result.target_bitrate);
|
||||
}
|
||||
bandwidth_estimation_->UpdateLossBasedEstimator(
|
||||
report, result.delay_detector_state, probe_bitrate);
|
||||
report, result.delay_detector_state, probe_bitrate,
|
||||
estimate_ ? estimate_->link_capacity_upper : DataRate::PlusInfinity());
|
||||
if (result.updated) {
|
||||
// Update the estimate in the ProbeController, in case we want to probe.
|
||||
MaybeTriggerOnNetworkChanged(&update, report.feedback_time);
|
||||
|
|
|
@ -219,8 +219,10 @@ void LossBasedBweV2::UpdateBandwidthEstimate(
|
|||
rtc::ArrayView<const PacketResult> packet_results,
|
||||
DataRate delay_based_estimate,
|
||||
BandwidthUsage delay_detector_state,
|
||||
absl::optional<DataRate> probe_bitrate) {
|
||||
absl::optional<DataRate> probe_bitrate,
|
||||
DataRate upper_link_capacity) {
|
||||
delay_based_estimate_ = delay_based_estimate;
|
||||
upper_link_capacity_ = upper_link_capacity;
|
||||
if (!IsEnabled()) {
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "The estimator must be enabled before it can be used.";
|
||||
|
@ -410,6 +412,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
|
|||
"SlopeOfBweHighLossFunc", 1000);
|
||||
FieldTrialParameter<bool> probe_integration_enabled("ProbeIntegrationEnabled",
|
||||
false);
|
||||
FieldTrialParameter<bool> bound_by_upper_link_capacity_when_loss_limited(
|
||||
"BoundByUpperLinkCapacityWhenLossLimited", true);
|
||||
if (key_value_config) {
|
||||
ParseFieldTrial({&enabled,
|
||||
&bandwidth_rampup_upper_bound_factor,
|
||||
|
@ -445,7 +449,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
|
|||
&probe_integration_enabled,
|
||||
&high_loss_rate_threshold,
|
||||
&bandwidth_cap_at_high_loss_rate,
|
||||
&slope_of_bwe_high_loss_func},
|
||||
&slope_of_bwe_high_loss_func,
|
||||
&bound_by_upper_link_capacity_when_loss_limited},
|
||||
key_value_config->Lookup("WebRTC-Bwe-LossBasedBweV2"));
|
||||
}
|
||||
|
||||
|
@ -506,6 +511,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
|
|||
bandwidth_cap_at_high_loss_rate.Get();
|
||||
config->slope_of_bwe_high_loss_func = slope_of_bwe_high_loss_func.Get();
|
||||
config->probe_integration_enabled = probe_integration_enabled.Get();
|
||||
config->bound_by_upper_link_capacity_when_loss_limited =
|
||||
bound_by_upper_link_capacity_when_loss_limited.Get();
|
||||
|
||||
return config;
|
||||
}
|
||||
|
@ -946,6 +953,12 @@ void LossBasedBweV2::CalculateInstantUpperBound() {
|
|||
}
|
||||
}
|
||||
|
||||
if (IsBandwidthLimitedDueToLoss()) {
|
||||
if (IsValid(upper_link_capacity_) &&
|
||||
config_->bound_by_upper_link_capacity_when_loss_limited) {
|
||||
instant_limit = std::min(instant_limit, upper_link_capacity_);
|
||||
}
|
||||
}
|
||||
cached_instant_upper_bound_ = instant_limit;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@ class LossBasedBweV2 {
|
|||
rtc::ArrayView<const PacketResult> packet_results,
|
||||
DataRate delay_based_estimate,
|
||||
BandwidthUsage delay_detector_state,
|
||||
absl::optional<DataRate> probe_bitrate);
|
||||
absl::optional<DataRate> probe_bitrate,
|
||||
DataRate upper_link_capacity);
|
||||
|
||||
private:
|
||||
struct ChannelParameters {
|
||||
|
@ -110,6 +111,7 @@ class LossBasedBweV2 {
|
|||
DataRate bandwidth_cap_at_high_loss_rate = DataRate::MinusInfinity();
|
||||
double slope_of_bwe_high_loss_func = 1000.0;
|
||||
bool probe_integration_enabled = false;
|
||||
bool bound_by_upper_link_capacity_when_loss_limited = false;
|
||||
};
|
||||
|
||||
struct Derivatives {
|
||||
|
@ -193,6 +195,7 @@ class LossBasedBweV2 {
|
|||
LossBasedState current_state_ = LossBasedState::kDelayBasedEstimate;
|
||||
DataRate probe_bitrate_ = DataRate::PlusInfinity();
|
||||
DataRate delay_based_estimate_ = DataRate::PlusInfinity();
|
||||
DataRate upper_link_capacity_ = DataRate::PlusInfinity();
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -205,7 +205,8 @@ TEST_P(LossBasedBweV2Test, ReturnsDelayBasedEstimateWhenDisabled) {
|
|||
/*packet_results=*/{},
|
||||
/*delay_based_estimate=*/DataRate::KilobitsPerSec(100),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_EQ(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
DataRate::KilobitsPerSec(100));
|
||||
|
@ -221,7 +222,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
/*packet_results=*/{},
|
||||
/*delay_based_estimate=*/DataRate::KilobitsPerSec(100),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_EQ(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
DataRate::KilobitsPerSec(100));
|
||||
|
@ -241,8 +243,10 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_TRUE(loss_based_bandwidth_estimator.IsReady());
|
||||
EXPECT_TRUE(loss_based_bandwidth_estimator.GetLossBasedResult()
|
||||
|
@ -259,8 +263,10 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNoInitialization) {
|
|||
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
||||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
|
||||
EXPECT_TRUE(loss_based_bandwidth_estimator.GetLossBasedResult()
|
||||
|
@ -294,8 +300,10 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
|
|||
.bandwidth_estimate.IsPlusInfinity());
|
||||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
not_enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
not_enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
|
||||
EXPECT_TRUE(loss_based_bandwidth_estimator.GetLossBasedResult()
|
||||
|
@ -320,8 +328,10 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_NE(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
|
@ -335,8 +345,10 @@ TEST_P(LossBasedBweV2Test,
|
|||
DataRate::KilobitsPerSec(600));
|
||||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_NE(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
|
@ -364,11 +376,15 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator_2.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator_1.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_EQ(
|
||||
loss_based_bandwidth_estimator_1.GetLossBasedResult().bandwidth_estimate,
|
||||
|
@ -382,11 +398,15 @@ TEST_P(LossBasedBweV2Test,
|
|||
DataRate::KilobitsPerSec(660));
|
||||
|
||||
loss_based_bandwidth_estimator_1.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_NE(
|
||||
loss_based_bandwidth_estimator_1.GetLossBasedResult().bandwidth_estimate,
|
||||
|
@ -407,8 +427,10 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_no_received_packets, DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_no_received_packets,
|
||||
/*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_EQ(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
|
@ -436,14 +458,17 @@ TEST_P(LossBasedBweV2Test, BandwidthEstimateNotIncreaseWhenNetworkUnderusing) {
|
|||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_LE(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_LE(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
DataRate::KilobitsPerSec(600));
|
||||
|
@ -470,8 +495,10 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// If the delay based estimate is infinity, then loss based estimate increases
|
||||
// and not bounded by delay based estimate.
|
||||
EXPECT_GT(
|
||||
|
@ -480,7 +507,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::KilobitsPerSec(500),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// If the delay based estimate is not infinity, then loss based estimate is
|
||||
// bounded by delay based estimate.
|
||||
EXPECT_EQ(
|
||||
|
@ -512,13 +540,17 @@ TEST_P(LossBasedBweV2Test, UseAckedBitrateForEmegencyBackOff) {
|
|||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_bitrate);
|
||||
// Update estimate when network is overusing, and 50% loss rate.
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwOverusing,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwOverusing,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// Update estimate again when network is continuously overusing, and 100%
|
||||
// loss rate.
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwOverusing,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwOverusing,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// The estimate bitrate now is backed off based on acked bitrate.
|
||||
EXPECT_LE(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
|
@ -541,15 +573,19 @@ TEST_P(LossBasedBweV2Test, NoBweChangeIfObservationDurationUnchanged) {
|
|||
DataRate::KilobitsPerSec(300));
|
||||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_1 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
|
||||
// Use the same feedback and check if the estimate is unchanged.
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_2 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
EXPECT_EQ(estimate_2, estimate_1);
|
||||
|
@ -574,14 +610,18 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_1 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_2 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
EXPECT_EQ(estimate_2, estimate_1);
|
||||
|
@ -606,14 +646,17 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_1 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_2 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
EXPECT_LE(estimate_2, estimate_1);
|
||||
|
@ -645,14 +688,18 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
||||
DataRate::KilobitsPerSec(300));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_1 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwOverusing,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwOverusing,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
DataRate estimate_2 =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
|
||||
EXPECT_LT(estimate_2, estimate_1);
|
||||
|
@ -677,13 +724,15 @@ TEST_P(LossBasedBweV2Test,
|
|||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_EQ(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
delay_based_estimate);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_EQ(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
delay_based_estimate);
|
||||
|
@ -711,7 +760,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
LossBasedBweV2::Result result_at_loss =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult();
|
||||
|
||||
|
@ -724,7 +774,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
LossBasedBweV2::Result result_after_recovery =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult();
|
||||
|
@ -755,7 +806,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
DataRate::KilobitsPerSec(300));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Change the acked bitrate to make sure that the estimate is bounded by a
|
||||
// factor of acked bitrate.
|
||||
|
@ -763,7 +815,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_bitrate);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// The estimate is capped by acked_bitrate * BwRampupUpperBoundFactor.
|
||||
DataRate estimate_2 =
|
||||
|
@ -798,14 +851,16 @@ TEST_P(LossBasedBweV2Test,
|
|||
DataRate::KilobitsPerSec(300));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// Increase the acknowledged bitrate to make sure that the estimate is not
|
||||
// capped too low.
|
||||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
||||
DataRate::KilobitsPerSec(5000));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// The estimate is capped by current_estimate * kMaxIncreaseFactor because
|
||||
// it recently backed off.
|
||||
|
@ -814,7 +869,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// The latest estimate is the same as the previous estimate since the sent
|
||||
// packets were sent within the DelayedIncreaseWindow.
|
||||
EXPECT_EQ(
|
||||
|
@ -847,14 +903,16 @@ TEST_P(LossBasedBweV2Test, KeepIncreasingEstimateAfterDelayedIncreaseWindow) {
|
|||
DataRate::KilobitsPerSec(300));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// Increase the acknowledged bitrate to make sure that the estimate is not
|
||||
// capped too low.
|
||||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
||||
DataRate::KilobitsPerSec(5000));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// The estimate is capped by current_estimate * kMaxIncreaseFactor because it
|
||||
// recently backed off.
|
||||
|
@ -863,7 +921,8 @@ TEST_P(LossBasedBweV2Test, KeepIncreasingEstimateAfterDelayedIncreaseWindow) {
|
|||
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
// The estimate can continue increasing after the DelayedIncreaseWindow.
|
||||
EXPECT_GE(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
|
@ -889,7 +948,8 @@ TEST_P(LossBasedBweV2Test, NotIncreaseIfInherentLossLessThanAverageLoss) {
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
||||
CreatePacketResultsWith10pLossRate(
|
||||
|
@ -897,7 +957,8 @@ TEST_P(LossBasedBweV2Test, NotIncreaseIfInherentLossLessThanAverageLoss) {
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_2, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Do not increase the bitrate because inherent loss is less than average loss
|
||||
EXPECT_EQ(
|
||||
|
@ -926,7 +987,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
||||
CreatePacketResultsWith10pLossRate(
|
||||
|
@ -934,7 +996,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_2, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Because LossThresholdOfHighBandwidthPreference is 20%, the average loss is
|
||||
// 10%, bandwidth estimate should increase.
|
||||
|
@ -964,7 +1027,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
||||
CreatePacketResultsWith10pLossRate(
|
||||
|
@ -972,7 +1036,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_2, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Because LossThresholdOfHighBandwidthPreference is 5%, the average loss is
|
||||
// 10%, bandwidth estimate should decrease.
|
||||
|
@ -1002,7 +1067,8 @@ TEST_P(LossBasedBweV2Test, UseProbeResultWhenRecoveringFromLoss) {
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt);
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Network recovers after loss.
|
||||
DataRate probe_estimate = DataRate::KilobitsPerSec(300);
|
||||
|
@ -1012,13 +1078,139 @@ TEST_P(LossBasedBweV2Test, UseProbeResultWhenRecoveringFromLoss) {
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
probe_estimate);
|
||||
probe_estimate, /*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
LossBasedBweV2::Result result_after_recovery =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult();
|
||||
EXPECT_EQ(result_after_recovery.bandwidth_estimate, probe_estimate);
|
||||
}
|
||||
|
||||
// If BoundByUpperLinkCapacityWhenLossLimited is enabled, the estimate is
|
||||
// bounded by the upper link capacity when bandwidth is loss limited.
|
||||
TEST_P(LossBasedBweV2Test, BoundEstimateByUpperLinkCapacityWhenLossLimited) {
|
||||
ExplicitKeyValueConfig key_value_config(
|
||||
"WebRTC-Bwe-LossBasedBweV2/"
|
||||
"Enabled:true,CandidateFactors:1.2|1|0.5,AckedRateCandidate:true,"
|
||||
"ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
|
||||
"InstantUpperBoundBwBalance:10000kbps,"
|
||||
"DelayBasedCandidate:true,MaxIncreaseFactor:1000,"
|
||||
"BwRampupUpperBoundFactor:2.0,BoundByUpperLinkCapacityWhenLossLimited:"
|
||||
"true/");
|
||||
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
||||
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
|
||||
DataRate acked_rate = DataRate::KilobitsPerSec(300);
|
||||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
|
||||
|
||||
// Create some loss to create the loss limited scenario.
|
||||
std::vector<PacketResult> enough_feedback_1 =
|
||||
CreatePacketResultsWith100pLossRate(
|
||||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Network recovers after loss.
|
||||
DataRate upper_link_capacity = DataRate::KilobitsPerSec(10);
|
||||
std::vector<PacketResult> enough_feedback_2 =
|
||||
CreatePacketResultsWithReceivedPackets(
|
||||
/*first_packet_timestamp=*/Timestamp::Zero() +
|
||||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt, upper_link_capacity);
|
||||
|
||||
LossBasedBweV2::Result result_after_recovery =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult();
|
||||
EXPECT_EQ(result_after_recovery.bandwidth_estimate, upper_link_capacity);
|
||||
}
|
||||
|
||||
// If BoundByUpperLinkCapacityWhenLossLimited is enabled, the estimate is not
|
||||
// bounded by the upper link capacity when bandwidth is not loss limited.
|
||||
TEST_P(LossBasedBweV2Test,
|
||||
NotBoundEstimateByUpperLinkCapacityWhenNotLossLimited) {
|
||||
ExplicitKeyValueConfig key_value_config(
|
||||
"WebRTC-Bwe-LossBasedBweV2/"
|
||||
"Enabled:true,CandidateFactors:1.2|1|0.5,AckedRateCandidate:true,"
|
||||
"ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
|
||||
"InstantUpperBoundBwBalance:10000kbps,"
|
||||
"DelayBasedCandidate:true,MaxIncreaseFactor:1000,"
|
||||
"BwRampupUpperBoundFactor:2.0,BoundByUpperLinkCapacityWhenLossLimited:"
|
||||
"true/");
|
||||
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
||||
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
|
||||
DataRate acked_rate = DataRate::KilobitsPerSec(300);
|
||||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
|
||||
|
||||
// Create a normal network without loss
|
||||
std::vector<PacketResult> enough_feedback_1 =
|
||||
CreatePacketResultsWithReceivedPackets(
|
||||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
DataRate upper_link_capacity = DataRate::KilobitsPerSec(10);
|
||||
std::vector<PacketResult> enough_feedback_2 =
|
||||
CreatePacketResultsWithReceivedPackets(
|
||||
/*first_packet_timestamp=*/Timestamp::Zero() +
|
||||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt, upper_link_capacity);
|
||||
|
||||
LossBasedBweV2::Result loss_based_result =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult();
|
||||
EXPECT_GT(loss_based_result.bandwidth_estimate, upper_link_capacity);
|
||||
}
|
||||
|
||||
// If BoundByUpperLinkCapacityWhenLossLimited is disabled, the estimate is not
|
||||
// bounded by the upper link capacity.
|
||||
TEST_P(LossBasedBweV2Test, NotBoundEstimateByUpperLinkCapacity) {
|
||||
ExplicitKeyValueConfig key_value_config(
|
||||
"WebRTC-Bwe-LossBasedBweV2/"
|
||||
"Enabled:true,CandidateFactors:1.2|1|0.5,AckedRateCandidate:true,"
|
||||
"ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
|
||||
"InstantUpperBoundBwBalance:10000kbps,"
|
||||
"DelayBasedCandidate:true,MaxIncreaseFactor:1000,"
|
||||
"BwRampupUpperBoundFactor:2.0,BoundByUpperLinkCapacityWhenLossLimited:"
|
||||
"false/");
|
||||
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
||||
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
|
||||
DataRate acked_rate = DataRate::KilobitsPerSec(300);
|
||||
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
|
||||
|
||||
// Create some loss to create the loss limited scenario.
|
||||
std::vector<PacketResult> enough_feedback_1 =
|
||||
CreatePacketResultsWith100pLossRate(
|
||||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Network recovers after loss.
|
||||
DataRate upper_link_capacity = DataRate::KilobitsPerSec(10);
|
||||
std::vector<PacketResult> enough_feedback_2 =
|
||||
CreatePacketResultsWithReceivedPackets(
|
||||
/*first_packet_timestamp=*/Timestamp::Zero() +
|
||||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt, upper_link_capacity);
|
||||
|
||||
LossBasedBweV2::Result result_after_recovery =
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult();
|
||||
EXPECT_GT(result_after_recovery.bandwidth_estimate, upper_link_capacity);
|
||||
}
|
||||
|
||||
TEST_P(LossBasedBweV2Test,
|
||||
StricterBoundUsingHighLossRateThresholdAt10pLossRate) {
|
||||
ExplicitKeyValueConfig key_value_config(
|
||||
|
@ -1042,7 +1234,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
||||
CreatePacketResultsWith10pLossRate(
|
||||
|
@ -1050,7 +1243,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_10p_loss_2, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// At 10% loss rate and high loss rate threshold to be 10%, cap the estimate
|
||||
// to be 500 * 1000-0.1 = 400kbps.
|
||||
|
@ -1082,7 +1276,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_50p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
std::vector<PacketResult> enough_feedback_50p_loss_2 =
|
||||
CreatePacketResultsWith50pLossRate(
|
||||
|
@ -1090,7 +1285,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_50p_loss_2, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// At 50% loss rate and high loss rate threshold to be 30%, cap the estimate
|
||||
// to be the min bitrate.
|
||||
|
@ -1122,7 +1318,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_100p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
std::vector<PacketResult> enough_feedback_100p_loss_2 =
|
||||
CreatePacketResultsWith100pLossRate(
|
||||
|
@ -1130,7 +1327,8 @@ TEST_P(LossBasedBweV2Test,
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_100p_loss_2, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// At 100% loss rate and high loss rate threshold to be 30%, cap the estimate
|
||||
// to be the min bitrate.
|
||||
|
@ -1161,7 +1359,8 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_100p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// Make sure that the estimate is set to min bitrate because of 100% loss
|
||||
// rate.
|
||||
|
@ -1176,7 +1375,8 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
|
|||
kObservationDurationLowerBound);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_0p_loss_1, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
std::vector<PacketResult> enough_feedback_0p_loss_2 =
|
||||
CreatePacketResultsWithReceivedPackets(
|
||||
|
@ -1184,7 +1384,8 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
|
|||
kObservationDurationLowerBound * 2);
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_0p_loss_2, delay_based_estimate,
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
// The estimate increases as network recovers.
|
||||
EXPECT_GT(
|
||||
|
@ -1207,7 +1408,8 @@ TEST_P(LossBasedBweV2Test, EstimateIsNotHigherThanMaxBitrate) {
|
|||
/*first_packet_timestamp=*/Timestamp::Zero());
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
||||
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
|
||||
EXPECT_LE(
|
||||
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
|
||||
|
|
|
@ -369,7 +369,8 @@ void SendSideBandwidthEstimation::SetAcknowledgedRate(
|
|||
void SendSideBandwidthEstimation::UpdateLossBasedEstimator(
|
||||
const TransportPacketsFeedback& report,
|
||||
BandwidthUsage delay_detector_state,
|
||||
absl::optional<DataRate> probe_bitrate) {
|
||||
absl::optional<DataRate> probe_bitrate,
|
||||
DataRate upper_link_capacity) {
|
||||
if (LossBasedBandwidthEstimatorV1Enabled()) {
|
||||
loss_based_bandwidth_estimator_v1_.UpdateLossStatistics(
|
||||
report.packet_feedbacks, report.feedback_time);
|
||||
|
@ -377,7 +378,7 @@ void SendSideBandwidthEstimation::UpdateLossBasedEstimator(
|
|||
if (LossBasedBandwidthEstimatorV2Enabled()) {
|
||||
loss_based_bandwidth_estimator_v2_.UpdateBandwidthEstimate(
|
||||
report.packet_feedbacks, delay_based_limit_, delay_detector_state,
|
||||
probe_bitrate);
|
||||
probe_bitrate, upper_link_capacity);
|
||||
UpdateEstimate(report.feedback_time);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,8 @@ class SendSideBandwidthEstimation {
|
|||
Timestamp at_time);
|
||||
void UpdateLossBasedEstimator(const TransportPacketsFeedback& report,
|
||||
BandwidthUsage delay_detector_state,
|
||||
absl::optional<DataRate> probe_bitrate);
|
||||
absl::optional<DataRate> probe_bitrate,
|
||||
DataRate upper_link_capacity);
|
||||
|
||||
private:
|
||||
friend class GoogCcStatePrinter;
|
||||
|
|
Loading…
Reference in a new issue