Use acked bitrate as a candidate if padding is sent.

Bug: webrtc:12707
Change-Id: Ie824bdef09e685d0a4810177cbe5af57e699ad84
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325480
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41052}
This commit is contained in:
Diep Bui 2023-10-31 13:44:13 +00:00 committed by WebRTC LUCI CQ
parent 86f09ae3f6
commit cf2fe18daa
2 changed files with 54 additions and 1 deletions

View File

@ -855,7 +855,10 @@ std::vector<LossBasedBweV2::ChannelParameters> LossBasedBweV2::GetCandidates(
if (acknowledged_bitrate_.has_value() && if (acknowledged_bitrate_.has_value() &&
config_->append_acknowledged_rate_candidate) { config_->append_acknowledged_rate_candidate) {
if (!(config_->not_use_acked_rate_in_alr && in_alr)) { if (!(config_->not_use_acked_rate_in_alr && in_alr) ||
(config_->padding_duration > TimeDelta::Zero() &&
last_padding_info_.padding_timestamp + config_->padding_duration >=
last_send_time_most_recent_observation_)) {
bandwidths.push_back(*acknowledged_bitrate_ * bandwidths.push_back(*acknowledged_bitrate_ *
config_->bandwidth_backoff_lower_bound_factor); config_->bandwidth_backoff_lower_bound_factor);
} }

View File

@ -1542,6 +1542,56 @@ TEST_F(LossBasedBweV2Test, IncreaseUsingPaddingStateIfFieldTrial) {
LossBasedState::kIncreaseUsingPadding); LossBasedState::kIncreaseUsingPadding);
} }
TEST_F(LossBasedBweV2Test, DecreaseToAckedCandidateIfPaddingInAlr) {
ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
"PaddingDuration:1000ms,"
// Set InstantUpperBoundBwBalance high to disable InstantUpperBound cap.
"InstantUpperBoundBwBalance:10000kbps"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(1000));
int feedback_id = 0;
while (loss_based_bandwidth_estimator.GetLossBasedResult().state !=
LossBasedState::kDecreasing) {
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
CreatePacketResultsWith100pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound * feedback_id),
/*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/true);
feedback_id++;
}
while (loss_based_bandwidth_estimator.GetLossBasedResult().state !=
LossBasedState::kIncreaseUsingPadding) {
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
CreatePacketResultsWithReceivedPackets(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound * feedback_id),
/*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/true);
feedback_id++;
}
ASSERT_GT(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(900));
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(100));
// Padding is sent now, create some lost packets.
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
CreatePacketResultsWith100pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound * feedback_id),
/*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/true);
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDecreasing);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(100));
}
TEST_F(LossBasedBweV2Test, DecreaseAfterPadding) { TEST_F(LossBasedBweV2Test, DecreaseAfterPadding) {
ExplicitKeyValueConfig key_value_config(ShortObservationConfig( ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
"PaddingDuration:1000ms,BwRampupUpperBoundFactor:2.0")); "PaddingDuration:1000ms,BwRampupUpperBoundFactor:2.0"));