|
|
|
|
@ -202,8 +202,10 @@ TEST_P(LossBasedBweV2Test, ReturnsDelayBasedEstimateWhenDisabled) {
|
|
|
|
|
/*trendline_integration_enabled=*/GetParam()));
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::KilobitsPerSec(100)),
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::KilobitsPerSec(100))
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(100));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -214,8 +216,10 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
/*trendline_integration_enabled=*/GetParam()));
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::KilobitsPerSec(100)),
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::KilobitsPerSec(100))
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(100));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -233,13 +237,14 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(loss_based_bandwidth_estimator.IsReady());
|
|
|
|
|
EXPECT_TRUE(
|
|
|
|
|
loss_based_bandwidth_estimator
|
|
|
|
|
.GetBandwidthEstimate(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.IsFinite());
|
|
|
|
|
.GetLossBasedResult(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate.IsFinite());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNoInitialization) {
|
|
|
|
|
@ -252,13 +257,14 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNoInitialization) {
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
|
|
|
|
|
EXPECT_TRUE(
|
|
|
|
|
loss_based_bandwidth_estimator
|
|
|
|
|
.GetBandwidthEstimate(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.IsPlusInfinity());
|
|
|
|
|
.GetLossBasedResult(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate.IsPlusInfinity());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
|
|
|
|
|
@ -286,17 +292,18 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
|
|
|
|
|
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
|
|
|
|
|
EXPECT_TRUE(
|
|
|
|
|
loss_based_bandwidth_estimator
|
|
|
|
|
.GetBandwidthEstimate(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.IsPlusInfinity());
|
|
|
|
|
.GetLossBasedResult(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate.IsPlusInfinity());
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
not_enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
not_enough_feedback, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
|
|
|
|
|
EXPECT_TRUE(
|
|
|
|
|
loss_based_bandwidth_estimator
|
|
|
|
|
.GetBandwidthEstimate(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.IsPlusInfinity());
|
|
|
|
|
.GetLossBasedResult(/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate.IsPlusInfinity());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_P(LossBasedBweV2Test,
|
|
|
|
|
@ -317,24 +324,32 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_NE(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_NE(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_NE(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_NE(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -359,30 +374,42 @@ 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);
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator_1.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator_1
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(660));
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator_1.SetAcknowledgedBitrate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
DataRate::KilobitsPerSec(900));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator_1.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator_1
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(660));
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator_1.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_NE(loss_based_bandwidth_estimator_1.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
loss_based_bandwidth_estimator_2.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()));
|
|
|
|
|
EXPECT_NE(loss_based_bandwidth_estimator_1
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
loss_based_bandwidth_estimator_2
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_P(LossBasedBweV2Test,
|
|
|
|
|
@ -400,10 +427,12 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_no_received_packets, DataRate::PlusInfinity(),
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(100));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -429,14 +458,19 @@ TEST_P(LossBasedBweV2Test, BandwidthEstimateNotIncreaseWhenNetworkUnderusing) {
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(),
|
|
|
|
|
BandwidthUsage::kBwUnderusing);
|
|
|
|
|
EXPECT_LE(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
EXPECT_LE(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
EXPECT_LE(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
EXPECT_LE(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -461,18 +495,24 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// If the delay based estimate is infinity, then loss based estimate increases
|
|
|
|
|
// and not bounded by delay based estimate.
|
|
|
|
|
EXPECT_GT(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_GT(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// If the delay based estimate is not infinity, then loss based estimate is
|
|
|
|
|
// bounded by delay based estimate.
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::KilobitsPerSec(500)),
|
|
|
|
|
EXPECT_EQ(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::KilobitsPerSec(500))
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(500));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -500,16 +540,18 @@ 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);
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwOverusing,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// Update estimate again when network is continuously overusing, and 100%
|
|
|
|
|
// loss rate.
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(),
|
|
|
|
|
BandwidthUsage::kBwOverusing);
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwOverusing,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// The estimate bitrate now is backed off based on acked bitrate.
|
|
|
|
|
EXPECT_LE(loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity()),
|
|
|
|
|
EXPECT_LE(loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
acked_bitrate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -529,15 +571,21 @@ TEST_P(LossBasedBweV2Test, NoBweChangeIfObservationDurationUnchanged) {
|
|
|
|
|
DataRate::KilobitsPerSec(300));
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.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);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
EXPECT_EQ(estimate_2, estimate_1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -560,14 +608,20 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
EXPECT_EQ(estimate_2, estimate_1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -590,15 +644,20 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(),
|
|
|
|
|
BandwidthUsage::kBwUnderusing);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
EXPECT_LE(estimate_2, estimate_1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -628,15 +687,20 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
|
|
|
|
DataRate::KilobitsPerSec(300));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
enough_feedback_1, DataRate::PlusInfinity(), BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_1 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(),
|
|
|
|
|
BandwidthUsage::kBwOverusing);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator.GetBandwidthEstimate(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity());
|
|
|
|
|
enough_feedback_2, DataRate::PlusInfinity(), BandwidthUsage::kBwOverusing,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
DataRate estimate_2 = loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(
|
|
|
|
|
/*delay_based_limit=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
EXPECT_LT(estimate_2, estimate_1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -658,28 +722,75 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
delay_based_estimate);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
delay_based_estimate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// After loss based bwe backs off, the next estimate is capped by
|
|
|
|
|
// MaxIncreaseFactor * current estimate.
|
|
|
|
|
TEST_P(LossBasedBweV2Test,
|
|
|
|
|
IncreaseByMaxIncreaseFactorAfterLossBasedBweBacksOff) {
|
|
|
|
|
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:1.5,BwRampupUpperBoundFactor:"
|
|
|
|
|
"2.0/");
|
|
|
|
|
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 =
|
|
|
|
|
CreatePacketResultsWithReceivedPackets(
|
|
|
|
|
CreatePacketResultsWith100pLossRate(
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
LossBasedBweV2::Result result_at_loss =
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate);
|
|
|
|
|
|
|
|
|
|
// Network recovers after loss.
|
|
|
|
|
std::vector<PacketResult> enough_feedback_2 =
|
|
|
|
|
CreatePacketResultsWithReceivedPackets(
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero() +
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
LossBasedBweV2::Result result_after_recovery =
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate);
|
|
|
|
|
EXPECT_EQ(result_after_recovery.bandwidth_estimate,
|
|
|
|
|
result_at_loss.bandwidth_estimate * 1.5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// After loss based bwe backs off, the next estimate is capped by
|
|
|
|
|
// a factor of acked bitrate.
|
|
|
|
|
TEST_P(LossBasedBweV2Test,
|
|
|
|
|
IncreaseByFactorOfAckedBitrateAfterLossBasedBweBacksOff) {
|
|
|
|
|
std::vector<PacketResult> enough_feedback_1 =
|
|
|
|
|
CreatePacketResultsWith100pLossRate(
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
std::vector<PacketResult> enough_feedback_2 =
|
|
|
|
|
CreatePacketResultsWith10pLossRate(
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero() +
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
ExplicitKeyValueConfig key_value_config(
|
|
|
|
|
Config(/*enabled=*/true, /*valid=*/true,
|
|
|
|
|
/*trendline_integration_enabled=*/GetParam()));
|
|
|
|
|
@ -691,22 +802,22 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
|
|
|
|
DataRate::KilobitsPerSec(300));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal);
|
|
|
|
|
DataRate estimate_1 =
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate);
|
|
|
|
|
// 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);
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// The estimate is capped by current_estimate * kMaxIncreaseFactor because it
|
|
|
|
|
// recently backed off.
|
|
|
|
|
// Change the acked bitrate to make sure that the estimate is bounded by a
|
|
|
|
|
// factor of acked bitrate.
|
|
|
|
|
DataRate acked_bitrate = DataRate::KilobitsPerSec(50);
|
|
|
|
|
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_bitrate);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// The estimate is capped by acked_bitrate * BwRampupUpperBoundFactor.
|
|
|
|
|
DataRate estimate_2 =
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate);
|
|
|
|
|
EXPECT_EQ(estimate_2, estimate_1 * kMaxIncreaseFactor);
|
|
|
|
|
EXPECT_LE(estimate_2, delay_based_estimate);
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
EXPECT_EQ(estimate_2, acked_bitrate * 1.2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// After loss based bwe backs off, the estimate is bounded during the delayed
|
|
|
|
|
@ -735,25 +846,30 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
|
|
|
|
DataRate::KilobitsPerSec(300));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// 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);
|
|
|
|
|
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// The estimate is capped by current_estimate * kMaxIncreaseFactor because
|
|
|
|
|
// it recently backed off.
|
|
|
|
|
DataRate estimate_2 =
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate);
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// The latest estimate is the same as the previous estimate since the sent
|
|
|
|
|
// packets were sent within the DelayedIncreaseWindow.
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
estimate_2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -781,24 +897,29 @@ TEST_P(LossBasedBweV2Test, KeepIncreasingEstimateAfterDelayedIncreaseWindow) {
|
|
|
|
|
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
|
|
|
|
DataRate::KilobitsPerSec(300));
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// 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);
|
|
|
|
|
enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// The estimate is capped by current_estimate * kMaxIncreaseFactor because it
|
|
|
|
|
// recently backed off.
|
|
|
|
|
DataRate estimate_2 =
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate);
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate;
|
|
|
|
|
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal);
|
|
|
|
|
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
|
|
|
|
|
/*probe_estimate=*/absl::nullopt);
|
|
|
|
|
// The estimate can continue increasing after the DelayedIncreaseWindow.
|
|
|
|
|
EXPECT_GE(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
estimate_2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -821,7 +942,7 @@ TEST_P(LossBasedBweV2Test, NotIncreaseIfInherentLossLessThanAverageLoss) {
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
|
|
|
|
CreatePacketResultsWith10pLossRate(
|
|
|
|
|
@ -829,11 +950,12 @@ TEST_P(LossBasedBweV2Test, NotIncreaseIfInherentLossLessThanAverageLoss) {
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_2, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// Do not increase the bitrate because inherent loss is less than average loss
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -858,7 +980,7 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
|
|
|
|
CreatePacketResultsWith10pLossRate(
|
|
|
|
|
@ -866,12 +988,13 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_2, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// Because LossThresholdOfHighBandwidthPreference is 20%, the average loss is
|
|
|
|
|
// 10%, bandwidth estimate should increase.
|
|
|
|
|
EXPECT_GT(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -896,7 +1019,7 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
|
|
|
|
CreatePacketResultsWith10pLossRate(
|
|
|
|
|
@ -904,15 +1027,54 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_2, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// Because LossThresholdOfHighBandwidthPreference is 5%, the average loss is
|
|
|
|
|
// 10%, bandwidth estimate should decrease.
|
|
|
|
|
EXPECT_LT(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(600));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_P(LossBasedBweV2Test, UseProbeResultWhenRecoveringFromLoss) {
|
|
|
|
|
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,ProbeIntegrationEnabled: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);
|
|
|
|
|
|
|
|
|
|
// Network recovers after loss.
|
|
|
|
|
DataRate probe_estimate = DataRate::KilobitsPerSec(300);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
LossBasedBweV2::Result result_after_recovery =
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate);
|
|
|
|
|
EXPECT_EQ(result_after_recovery.bandwidth_estimate, probe_estimate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_P(LossBasedBweV2Test,
|
|
|
|
|
StricterBoundUsingHighLossRateThresholdAt10pLossRate) {
|
|
|
|
|
ExplicitKeyValueConfig key_value_config(
|
|
|
|
|
@ -924,7 +1086,9 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
"HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
|
|
|
|
|
"05,HighLossRateThreshold:0.09/");
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
loss_based_bandwidth_estimator.SetMinBitrate(DataRate::KilobitsPerSec(10));
|
|
|
|
|
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));
|
|
|
|
|
@ -934,7 +1098,7 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
std::vector<PacketResult> enough_feedback_10p_loss_2 =
|
|
|
|
|
CreatePacketResultsWith10pLossRate(
|
|
|
|
|
@ -942,12 +1106,13 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_10p_loss_2, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// At 10% loss rate and high loss rate threshold to be 10%, cap the estimate
|
|
|
|
|
// to be 500 * 1000-0.1 = 400kbps.
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(400));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -962,7 +1127,9 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
"HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
|
|
|
|
|
"05,HighLossRateThreshold:0.3/");
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
loss_based_bandwidth_estimator.SetMinBitrate(DataRate::KilobitsPerSec(10));
|
|
|
|
|
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));
|
|
|
|
|
@ -972,7 +1139,7 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_50p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
std::vector<PacketResult> enough_feedback_50p_loss_2 =
|
|
|
|
|
CreatePacketResultsWith50pLossRate(
|
|
|
|
|
@ -980,12 +1147,13 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_50p_loss_2, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// At 50% loss rate and high loss rate threshold to be 30%, cap the estimate
|
|
|
|
|
// to be the min bitrate.
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(10));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1000,7 +1168,9 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
"HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
|
|
|
|
|
"05,HighLossRateThreshold:0.3/");
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
loss_based_bandwidth_estimator.SetMinBitrate(DataRate::KilobitsPerSec(10));
|
|
|
|
|
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));
|
|
|
|
|
@ -1010,7 +1180,7 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_100p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
std::vector<PacketResult> enough_feedback_100p_loss_2 =
|
|
|
|
|
CreatePacketResultsWith100pLossRate(
|
|
|
|
|
@ -1018,12 +1188,13 @@ TEST_P(LossBasedBweV2Test,
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_100p_loss_2, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// At 100% loss rate and high loss rate threshold to be 30%, cap the estimate
|
|
|
|
|
// to be the min bitrate.
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(10));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1037,7 +1208,9 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
|
|
|
|
|
"HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
|
|
|
|
|
"05,HighLossRateThreshold:0.3/");
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
loss_based_bandwidth_estimator.SetMinBitrate(DataRate::KilobitsPerSec(10));
|
|
|
|
|
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));
|
|
|
|
|
@ -1047,12 +1220,13 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_100p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// Make sure that the estimate is set to min bitrate because of 100% loss
|
|
|
|
|
// rate.
|
|
|
|
|
EXPECT_EQ(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(10));
|
|
|
|
|
|
|
|
|
|
// Create some feedbacks with 0 loss rate to simulate network recovering.
|
|
|
|
|
@ -1062,7 +1236,7 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
|
|
|
|
|
kObservationDurationLowerBound);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_0p_loss_1, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
std::vector<PacketResult> enough_feedback_0p_loss_2 =
|
|
|
|
|
CreatePacketResultsWithReceivedPackets(
|
|
|
|
|
@ -1070,14 +1244,39 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
|
|
|
|
|
kObservationDurationLowerBound * 2);
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback_0p_loss_2, delay_based_estimate,
|
|
|
|
|
BandwidthUsage::kBwNormal);
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
// The estimate increases as network recovers.
|
|
|
|
|
EXPECT_GT(
|
|
|
|
|
loss_based_bandwidth_estimator.GetBandwidthEstimate(delay_based_estimate),
|
|
|
|
|
loss_based_bandwidth_estimator.GetLossBasedResult(delay_based_estimate)
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(10));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_P(LossBasedBweV2Test, EstimateIsNotHigherThanMaxBitrate) {
|
|
|
|
|
ExplicitKeyValueConfig key_value_config(
|
|
|
|
|
Config(/*enabled=*/true, /*valid=*/true,
|
|
|
|
|
/*trendline_integration_enabled=*/GetParam()));
|
|
|
|
|
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
|
|
|
|
loss_based_bandwidth_estimator.SetMinMaxBitrate(
|
|
|
|
|
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
|
|
|
|
|
/*max_bitrate=*/DataRate::KilobitsPerSec(1000));
|
|
|
|
|
loss_based_bandwidth_estimator.SetBandwidthEstimate(
|
|
|
|
|
DataRate::KilobitsPerSec(1000));
|
|
|
|
|
std::vector<PacketResult> enough_feedback =
|
|
|
|
|
CreatePacketResultsWithReceivedPackets(
|
|
|
|
|
/*first_packet_timestamp=*/Timestamp::Zero());
|
|
|
|
|
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
|
|
|
|
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
|
|
|
|
|
BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt);
|
|
|
|
|
|
|
|
|
|
EXPECT_LE(
|
|
|
|
|
loss_based_bandwidth_estimator
|
|
|
|
|
.GetLossBasedResult(/*delay_based_estimate=*/DataRate::PlusInfinity())
|
|
|
|
|
.bandwidth_estimate,
|
|
|
|
|
DataRate::KilobitsPerSec(1000));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_SUITE_P(LossBasedBweV2Tests,
|
|
|
|
|
LossBasedBweV2Test,
|
|
|
|
|
::testing::Bool());
|
|
|
|
|
|