Do not use acknowledge bitrate for backing off in alr.
Without the flag enabled: https://screenshot.googleplex.com/BZ6fqsNHQAUxbyU
With the flag enabled: https://screenshot.googleplex.com/4GKrfvAdUpsQDx9
Bug: webrtc:12707
Change-Id: Ia1a9761aeaedc57cff6a2d1eca3c61519b9dd26e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293660
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39372}
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 9f47355..68e6231 100644
--- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
+++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
@@ -566,7 +566,8 @@
}
bandwidth_estimation_->UpdateLossBasedEstimator(
report, result.delay_detector_state, probe_bitrate,
- estimate_ ? estimate_->link_capacity_upper : DataRate::PlusInfinity());
+ estimate_ ? estimate_->link_capacity_upper : DataRate::PlusInfinity(),
+ alr_start_time.has_value());
if (result.updated) {
// Update the estimate in the ProbeController, in case we want to probe.
MaybeTriggerOnNetworkChanged(&update, report.feedback_time);
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
index b4d3ae8..223a928 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
@@ -220,7 +220,8 @@
DataRate delay_based_estimate,
BandwidthUsage delay_detector_state,
absl::optional<DataRate> probe_bitrate,
- DataRate upper_link_capacity) {
+ DataRate upper_link_capacity,
+ bool in_alr) {
delay_based_estimate_ = delay_based_estimate;
upper_link_capacity_ = upper_link_capacity;
if (!IsEnabled()) {
@@ -247,7 +248,7 @@
ChannelParameters best_candidate = current_estimate_;
double objective_max = std::numeric_limits<double>::lowest();
- for (ChannelParameters candidate : GetCandidates()) {
+ for (ChannelParameters candidate : GetCandidates(in_alr)) {
NewtonsMethodUpdate(candidate);
const double candidate_objective = GetObjective(candidate);
@@ -413,6 +414,8 @@
false);
FieldTrialParameter<bool> bound_by_upper_link_capacity_when_loss_limited(
"BoundByUpperLinkCapacityWhenLossLimited", true);
+ FieldTrialParameter<bool> not_use_acked_rate_in_alr("NotUseAckedRateInAlr",
+ false);
if (key_value_config) {
ParseFieldTrial({&enabled,
&bandwidth_rampup_upper_bound_factor,
@@ -449,7 +452,8 @@
&high_loss_rate_threshold,
&bandwidth_cap_at_high_loss_rate,
&slope_of_bwe_high_loss_func,
- &bound_by_upper_link_capacity_when_loss_limited},
+ &bound_by_upper_link_capacity_when_loss_limited,
+ ¬_use_acked_rate_in_alr},
key_value_config->Lookup("WebRTC-Bwe-LossBasedBweV2"));
}
@@ -512,6 +516,7 @@
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();
+ config->not_use_acked_rate_in_alr = not_use_acked_rate_in_alr.Get();
return config;
}
@@ -756,8 +761,8 @@
return candidate_bandwidth_upper_bound;
}
-std::vector<LossBasedBweV2::ChannelParameters> LossBasedBweV2::GetCandidates()
- const {
+std::vector<LossBasedBweV2::ChannelParameters> LossBasedBweV2::GetCandidates(
+ bool in_alr) const {
std::vector<DataRate> bandwidths;
bool can_increase_bitrate = TrendlineEsimateAllowBitrateIncrease();
for (double candidate_factor : config_->candidate_factors) {
@@ -771,8 +776,10 @@
if (acknowledged_bitrate_.has_value() &&
config_->append_acknowledged_rate_candidate &&
TrendlineEsimateAllowEmergencyBackoff()) {
- bandwidths.push_back(*acknowledged_bitrate_ *
- config_->bandwidth_backoff_lower_bound_factor);
+ if (!(config_->not_use_acked_rate_in_alr && in_alr)) {
+ bandwidths.push_back(*acknowledged_bitrate_ *
+ config_->bandwidth_backoff_lower_bound_factor);
+ }
}
if (IsValid(delay_based_estimate_) &&
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
index 9ff9cb7..84f2378 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
@@ -67,7 +67,8 @@
DataRate delay_based_estimate,
BandwidthUsage delay_detector_state,
absl::optional<DataRate> probe_bitrate,
- DataRate upper_link_capacity);
+ DataRate upper_link_capacity,
+ bool in_alr);
private:
struct ChannelParameters {
@@ -112,6 +113,7 @@
double slope_of_bwe_high_loss_func = 1000.0;
bool probe_integration_enabled = false;
bool bound_by_upper_link_capacity_when_loss_limited = false;
+ bool not_use_acked_rate_in_alr = false;
};
struct Derivatives {
@@ -141,7 +143,7 @@
// Returns `0.0` if not enough loss statistics have been received.
double GetAverageReportedLossRatio() const;
- std::vector<ChannelParameters> GetCandidates() const;
+ std::vector<ChannelParameters> GetCandidates(bool in_alr) const;
DataRate GetCandidateBandwidthUpperBound() const;
Derivatives GetDerivatives(const ChannelParameters& channel_parameters) const;
double GetFeasibleInherentLoss(
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc b/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc
index c303c29..6771420 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc
@@ -206,7 +206,7 @@
/*delay_based_estimate=*/DataRate::KilobitsPerSec(100),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(100));
@@ -223,7 +223,7 @@
/*delay_based_estimate=*/DataRate::KilobitsPerSec(100),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(100));
@@ -246,7 +246,7 @@
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_TRUE(loss_based_bandwidth_estimator.IsReady());
EXPECT_TRUE(loss_based_bandwidth_estimator.GetLossBasedResult()
@@ -266,7 +266,7 @@
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
EXPECT_TRUE(loss_based_bandwidth_estimator.GetLossBasedResult()
@@ -303,7 +303,7 @@
not_enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
EXPECT_TRUE(loss_based_bandwidth_estimator.GetLossBasedResult()
@@ -331,7 +331,7 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_NE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
@@ -348,7 +348,7 @@
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_NE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
@@ -379,12 +379,12 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator_1.GetLossBasedResult().bandwidth_estimate,
@@ -401,12 +401,12 @@
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_NE(
loss_based_bandwidth_estimator_1.GetLossBasedResult().bandwidth_estimate,
@@ -430,7 +430,7 @@
enough_feedback_no_received_packets,
/*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
@@ -460,7 +460,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_LE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(600));
@@ -468,7 +468,7 @@
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_LE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(600));
@@ -498,7 +498,7 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// If the delay based estimate is infinity, then loss based estimate increases
// and not bounded by delay based estimate.
EXPECT_GT(
@@ -508,7 +508,7 @@
enough_feedback_2, /*delay_based_estimate=*/DataRate::KilobitsPerSec(500),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// If the delay based estimate is not infinity, then loss based estimate is
// bounded by delay based estimate.
EXPECT_EQ(
@@ -543,14 +543,14 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwOverusing,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Update estimate again when network is continuously overusing, and 100%
// loss rate.
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwOverusing,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// The estimate bitrate now is backed off based on acked bitrate.
EXPECT_LE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
@@ -576,7 +576,7 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_1 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
@@ -585,7 +585,7 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
EXPECT_EQ(estimate_2, estimate_1);
@@ -613,7 +613,7 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_1 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
@@ -621,7 +621,7 @@
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
EXPECT_EQ(estimate_2, estimate_1);
@@ -649,14 +649,14 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_1 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
EXPECT_LE(estimate_2, estimate_1);
@@ -691,7 +691,7 @@
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_1 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
@@ -699,7 +699,7 @@
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwOverusing,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
EXPECT_LT(estimate_2, estimate_1);
@@ -725,14 +725,14 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
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,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
delay_based_estimate);
@@ -761,7 +761,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
LossBasedBweV2::Result result_at_loss =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -775,7 +775,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
LossBasedBweV2::Result result_after_recovery =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -807,7 +807,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDecreasing);
@@ -821,7 +821,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDelayBasedEstimate);
@@ -835,7 +835,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDelayBasedEstimate);
}
@@ -864,7 +864,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDecreasing);
@@ -878,7 +878,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_NE(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDelayBasedEstimate);
}
@@ -909,7 +909,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Change the acked bitrate to make sure that the estimate is bounded by a
// factor of acked bitrate.
@@ -918,7 +918,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// The estimate is capped by acked_bitrate * BwRampupUpperBoundFactor.
DataRate estimate_2 =
@@ -954,7 +954,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Increase the acknowledged bitrate to make sure that the estimate is not
// capped too low.
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
@@ -962,7 +962,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// The estimate is capped by current_estimate * kMaxIncreaseFactor because
// it recently backed off.
@@ -972,7 +972,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// The latest estimate is the same as the previous estimate since the sent
// packets were sent within the DelayedIncreaseWindow.
EXPECT_EQ(
@@ -1006,7 +1006,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Increase the acknowledged bitrate to make sure that the estimate is not
// capped too low.
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
@@ -1014,7 +1014,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// The estimate is capped by current_estimate * kMaxIncreaseFactor because it
// recently backed off.
@@ -1024,7 +1024,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// The estimate can continue increasing after the DelayedIncreaseWindow.
EXPECT_GE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
@@ -1051,7 +1051,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
CreatePacketResultsWith10pLossRate(
@@ -1060,7 +1060,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_2, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Do not increase the bitrate because inherent loss is less than average loss
EXPECT_EQ(
@@ -1090,7 +1090,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
CreatePacketResultsWith10pLossRate(
@@ -1099,7 +1099,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_2, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Because LossThresholdOfHighBandwidthPreference is 20%, the average loss is
// 10%, bandwidth estimate should increase.
@@ -1130,7 +1130,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
CreatePacketResultsWith10pLossRate(
@@ -1139,7 +1139,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_2, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Because LossThresholdOfHighBandwidthPreference is 5%, the average loss is
// 10%, bandwidth estimate should decrease.
@@ -1170,7 +1170,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Network recovers after loss.
DataRate probe_estimate = DataRate::KilobitsPerSec(300);
@@ -1180,7 +1180,8 @@
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- probe_estimate, /*upper_link_capacity=*/DataRate::PlusInfinity());
+ probe_estimate, /*upper_link_capacity=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
LossBasedBweV2::Result result_after_recovery =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -1212,7 +1213,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Network recovers after loss.
DataRate upper_link_capacity = DataRate::KilobitsPerSec(10);
@@ -1222,7 +1223,7 @@
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt, upper_link_capacity);
+ /*probe_estimate=*/absl::nullopt, upper_link_capacity, /*in_alr=*/false);
LossBasedBweV2::Result result_after_recovery =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -1255,7 +1256,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
DataRate upper_link_capacity = DataRate::KilobitsPerSec(10);
std::vector<PacketResult> enough_feedback_2 =
@@ -1264,7 +1265,7 @@
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt, upper_link_capacity);
+ /*probe_estimate=*/absl::nullopt, upper_link_capacity, /*in_alr=*/false);
LossBasedBweV2::Result loss_based_result =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -1296,7 +1297,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
/*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Network recovers after loss.
DataRate upper_link_capacity = DataRate::KilobitsPerSec(10);
@@ -1306,7 +1307,7 @@
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt, upper_link_capacity);
+ /*probe_estimate=*/absl::nullopt, upper_link_capacity, /*in_alr=*/false);
LossBasedBweV2::Result result_after_recovery =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -1337,7 +1338,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
CreatePacketResultsWith10pLossRate(
@@ -1346,7 +1347,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_2, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// At 10% loss rate and high loss rate threshold to be 10%, cap the estimate
// to be 500 * 1000-0.1 = 400kbps.
@@ -1379,7 +1380,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_50p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
std::vector<PacketResult> enough_feedback_50p_loss_2 =
CreatePacketResultsWith50pLossRate(
@@ -1388,7 +1389,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_50p_loss_2, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// At 50% loss rate and high loss rate threshold to be 30%, cap the estimate
// to be the min bitrate.
@@ -1421,7 +1422,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
std::vector<PacketResult> enough_feedback_100p_loss_2 =
CreatePacketResultsWith100pLossRate(
@@ -1430,7 +1431,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_2, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// At 100% loss rate and high loss rate threshold to be 30%, cap the estimate
// to be the min bitrate.
@@ -1462,7 +1463,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// Make sure that the estimate is set to min bitrate because of 100% loss
// rate.
@@ -1478,7 +1479,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_0p_loss_1, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
std::vector<PacketResult> enough_feedback_0p_loss_2 =
CreatePacketResultsWithReceivedPackets(
@@ -1487,7 +1488,7 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_0p_loss_2, delay_based_estimate,
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
// The estimate increases as network recovers.
EXPECT_GT(
@@ -1511,13 +1512,79 @@
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
- /*upper_link_capacity=*/DataRate::PlusInfinity());
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
EXPECT_LE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(1000));
}
+TEST_P(LossBasedBweV2Test, NotBackOffToAckedRateInAlr) {
+ ExplicitKeyValueConfig key_value_config(
+ "WebRTC-Bwe-LossBasedBweV2/"
+ "Enabled:true,CandidateFactors:1.1|1.0|0.9,AckedRateCandidate:true,"
+ "ObservationWindowSize:2,"
+ "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
+ "ObservationDurationLowerBound:200ms,NotUseAckedRateInAlr:true/");
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetMinMaxBitrate(
+ /*min_bitrate=*/DataRate::KilobitsPerSec(10),
+ /*max_bitrate=*/DataRate::KilobitsPerSec(1000000));
+ DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(600));
+
+ DataRate acked_rate = DataRate::KilobitsPerSec(100);
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
+ std::vector<PacketResult> enough_feedback_100p_loss_1 =
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero());
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ enough_feedback_100p_loss_1, delay_based_estimate,
+ BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/true);
+
+ // Make sure that the estimate decreases but higher than acked rate.
+ EXPECT_GT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ acked_rate);
+
+ EXPECT_LT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(600));
+}
+
+TEST_P(LossBasedBweV2Test, BackOffToAckedRateIfNotInAlr) {
+ ExplicitKeyValueConfig key_value_config(
+ "WebRTC-Bwe-LossBasedBweV2/"
+ "Enabled:true,CandidateFactors:1.1|1.0|0.9,AckedRateCandidate:true,"
+ "ObservationWindowSize:2,"
+ "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
+ "ObservationDurationLowerBound:200ms,NotUseAckedRateInAlr:true/");
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetMinMaxBitrate(
+ /*min_bitrate=*/DataRate::KilobitsPerSec(10),
+ /*max_bitrate=*/DataRate::KilobitsPerSec(1000000));
+ DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(600));
+
+ DataRate acked_rate = DataRate::KilobitsPerSec(100);
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
+ std::vector<PacketResult> enough_feedback_100p_loss_1 =
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero());
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ enough_feedback_100p_loss_1, delay_based_estimate,
+ BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+ /*upper_link_capacity=*/DataRate::PlusInfinity(), /*in_alr=*/false);
+
+ // Make sure that the estimate decreases but higher than acked rate.
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ acked_rate);
+}
+
INSTANTIATE_TEST_SUITE_P(LossBasedBweV2Tests,
LossBasedBweV2Test,
::testing::Bool());
diff --git a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc
index 6d3e42c..55270be 100644
--- a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc
+++ b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc
@@ -375,7 +375,8 @@
const TransportPacketsFeedback& report,
BandwidthUsage delay_detector_state,
absl::optional<DataRate> probe_bitrate,
- DataRate upper_link_capacity) {
+ DataRate upper_link_capacity,
+ bool in_alr) {
if (LossBasedBandwidthEstimatorV1Enabled()) {
loss_based_bandwidth_estimator_v1_.UpdateLossStatistics(
report.packet_feedbacks, report.feedback_time);
@@ -383,7 +384,7 @@
if (LossBasedBandwidthEstimatorV2Enabled()) {
loss_based_bandwidth_estimator_v2_.UpdateBandwidthEstimate(
report.packet_feedbacks, delay_based_limit_, delay_detector_state,
- probe_bitrate, upper_link_capacity);
+ probe_bitrate, upper_link_capacity, in_alr);
UpdateEstimate(report.feedback_time);
}
}
diff --git a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h
index 98c8dfa..5a037db 100644
--- a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h
+++ b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h
@@ -127,7 +127,8 @@
void UpdateLossBasedEstimator(const TransportPacketsFeedback& report,
BandwidthUsage delay_detector_state,
absl::optional<DataRate> probe_bitrate,
- DataRate upper_link_capacity);
+ DataRate upper_link_capacity,
+ bool in_alr);
private:
friend class GoogCcStatePrinter;