Send CCFB at least every 250ms even if BWE is zero.

This aligns with current transport sequence number feedback

Bug: webrtc:42225697, b/377028537
Change-Id: I9d3bcc2e131f1a2c20d5f8c3fe5776268b97e00a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/367386
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43352}
This commit is contained in:
Per Kjellander 2024-11-03 11:48:02 +00:00 committed by WebRTC LUCI CQ
parent 7c7290ba48
commit 1d3f51650c
2 changed files with 39 additions and 1 deletions

View File

@ -124,7 +124,9 @@ void CongestionControlFeedbackGenerator::CalculateNextPossibleSendTime(
send_rate_debt_ += feedback_size + packet_overhead_;
last_feedback_sent_time_ = now;
next_possible_feedback_send_time_ =
now + std::clamp(send_rate_debt_ / max_feedback_rate_,
now + std::clamp(max_feedback_rate_.IsZero()
? TimeDelta::PlusInfinity()
: send_rate_debt_ / max_feedback_rate_,
min_time_between_feedback_.Get(),
max_time_between_feedback_.Get());
}

View File

@ -217,6 +217,42 @@ TEST(CongestionControlFeedbackGeneratorTest,
time_to_next_process = generator.Process(clock.CurrentTime());
}
TEST(CongestionControlFeedbackGeneratorTest,
SendsFeedbackAfterMax250MsIfBweZero) {
test::ExplicitKeyValueConfig field_trials(
"WebRTC-RFC8888CongestionControlFeedback/max_send_delta:250ms/");
MockFunction<void(std::vector<std::unique_ptr<rtcp::RtcpPacket>>)>
rtcp_sender;
SimulatedClock clock(123456);
constexpr TimeDelta kSmallTimeInterval = TimeDelta::Millis(2);
CongestionControlFeedbackGenerator generator(
CreateEnvironment(&clock, &field_trials), rtcp_sender.AsStdFunction());
// Regardless of BWE, feedback is sent at least every 250ms.
generator.OnSendBandwidthEstimateChanged(DataRate::Zero());
TimeDelta time_to_next_process = generator.Process(clock.CurrentTime());
clock.AdvanceTime(kSmallTimeInterval);
time_to_next_process -= kSmallTimeInterval;
Timestamp expected_feedback_time = clock.CurrentTime();
EXPECT_CALL(rtcp_sender, Call).Times(2).WillRepeatedly(WithoutArgs([&] {
EXPECT_EQ(clock.CurrentTime(), expected_feedback_time);
// Next feedback is not expected to be sent until 250ms after the
// previouse due to low send bandwidth.
expected_feedback_time += TimeDelta::Millis(250);
}));
generator.OnReceivedPacket(
CreatePacket(clock.CurrentTime(), /*marker=*/true));
clock.AdvanceTime(kSmallTimeInterval);
time_to_next_process -= kSmallTimeInterval;
generator.OnReceivedPacket(
CreatePacket(clock.CurrentTime(), /*marker=*/true));
clock.AdvanceTime(time_to_next_process);
time_to_next_process = generator.Process(clock.CurrentTime());
clock.AdvanceTime(time_to_next_process);
time_to_next_process = generator.Process(clock.CurrentTime());
}
TEST(CongestionControlFeedbackGeneratorTest,
CanGenerateRtcpPacketFromTwoSsrcWithMissingPacketsAndWrap) {
MockFunction<void(std::vector<std::unique_ptr<rtcp::RtcpPacket>>)>