Fix the loss based bwe state.
When best candidate estimate increases above the delay based estimate, the state should be DelayBasedEstimate because the final esimate is bounded by delay based bwe anyway. Bug: webrtc:12707 Change-Id: I0bcae684b33e5f1e9a7c57cb32c431b4eb58fd35 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283802 Reviewed-by: Per Kjellander <perkj@webrtc.org> Commit-Queue: Diep Bui <diepbp@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38677}
This commit is contained in:
parent
6eb1e709da
commit
34f4ec26e3
@ -309,13 +309,12 @@ void LossBasedBweV2::UpdateBandwidthEstimate(
|
||||
}
|
||||
}
|
||||
|
||||
if (IsEstimateIncreasingWhenLossLimited(best_candidate)) {
|
||||
if (IsEstimateIncreasingWhenLossLimited(best_candidate) &&
|
||||
best_candidate.loss_limited_bandwidth < delay_based_estimate) {
|
||||
current_state_ = LossBasedState::kIncreasing;
|
||||
} else if (IsValid(delay_based_estimate_) &&
|
||||
best_candidate.loss_limited_bandwidth < delay_based_estimate_) {
|
||||
} else if (best_candidate.loss_limited_bandwidth < delay_based_estimate_) {
|
||||
current_state_ = LossBasedState::kDecreasing;
|
||||
} else if (IsValid(delay_based_estimate_) &&
|
||||
best_candidate.loss_limited_bandwidth == delay_based_estimate_) {
|
||||
} else if (best_candidate.loss_limited_bandwidth >= delay_based_estimate_) {
|
||||
current_state_ = LossBasedState::kDelayBasedEstimate;
|
||||
}
|
||||
current_estimate_ = best_candidate;
|
||||
|
||||
@ -783,6 +783,106 @@ TEST_P(LossBasedBweV2Test,
|
||||
result_at_loss.bandwidth_estimate * 1.5);
|
||||
}
|
||||
|
||||
TEST_P(LossBasedBweV2Test,
|
||||
LossBasedStateIsDelayBasedEstimateAfterNetworkRecovering) {
|
||||
ExplicitKeyValueConfig key_value_config(
|
||||
"WebRTC-Bwe-LossBasedBweV2/"
|
||||
"Enabled:true,CandidateFactors:100|1|0.5,AckedRateCandidate:true,"
|
||||
"ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
|
||||
"InstantUpperBoundBwBalance:10000kbps,"
|
||||
"DelayBasedCandidate:true,MaxIncreaseFactor:100,"
|
||||
"BwRampupUpperBoundFactor:"
|
||||
"2.0/");
|
||||
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
||||
DataRate delay_based_estimate = DataRate::KilobitsPerSec(600);
|
||||
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());
|
||||
ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
|
||||
LossBasedState::kDecreasing);
|
||||
|
||||
// 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,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
|
||||
LossBasedState::kDelayBasedEstimate);
|
||||
|
||||
// Network recovers continuing.
|
||||
std::vector<PacketResult> enough_feedback_3 =
|
||||
CreatePacketResultsWithReceivedPackets(
|
||||
/*first_packet_timestamp=*/Timestamp::Zero() +
|
||||
kObservationDurationLowerBound * 2);
|
||||
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
|
||||
DataRate::KilobitsPerSec(600));
|
||||
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
|
||||
enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
|
||||
/*probe_estimate=*/absl::nullopt,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
|
||||
LossBasedState::kDelayBasedEstimate);
|
||||
}
|
||||
|
||||
TEST_P(LossBasedBweV2Test,
|
||||
LossBasedStateIsNotDelayBasedEstimateIfDelayBasedEsimtateInfinite) {
|
||||
ExplicitKeyValueConfig key_value_config(
|
||||
"WebRTC-Bwe-LossBasedBweV2/"
|
||||
"Enabled:true,CandidateFactors:100|1|0.5,AckedRateCandidate:true,"
|
||||
"ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
|
||||
"InstantUpperBoundBwBalance:10000kbps,"
|
||||
"DelayBasedCandidate:true,MaxIncreaseFactor:100,"
|
||||
"BwRampupUpperBoundFactor:"
|
||||
"2.0/");
|
||||
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
|
||||
DataRate delay_based_estimate = DataRate::PlusInfinity();
|
||||
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());
|
||||
ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
|
||||
LossBasedState::kDecreasing);
|
||||
|
||||
// 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,
|
||||
/*upper_link_capacity=*/DataRate::PlusInfinity());
|
||||
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
|
||||
LossBasedState::kIncreasing);
|
||||
}
|
||||
|
||||
// After loss based bwe backs off, the next estimate is capped by
|
||||
// a factor of acked bitrate.
|
||||
TEST_P(LossBasedBweV2Test,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user