Ensure packets are sorted on arrival time in CongestionControlFeedbackGenerator

Without this, packets may be sorted in the wrong order.

Bug: webrtc:42225697
Change-Id: Ib9a72cdc7cb8f7ef6ca1571d095a6474215a83f2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352821
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42411}
This commit is contained in:
Per K 2024-05-30 10:40:52 +00:00 committed by WebRTC LUCI CQ
parent 61dc3ac202
commit a97c292a05
2 changed files with 3 additions and 6 deletions

View File

@ -95,10 +95,8 @@ void CongestionControlFeedbackGenerator::SetTransportOverhead(
void CongestionControlFeedbackGenerator::SendFeedback(Timestamp now) { void CongestionControlFeedbackGenerator::SendFeedback(Timestamp now) {
absl::c_sort(packets_, [](const PacketInfo& a, const PacketInfo& b) { absl::c_sort(packets_, [](const PacketInfo& a, const PacketInfo& b) {
if (a.ssrc == b.ssrc) { return std::tie(a.ssrc, a.unwrapped_sequence_number, a.arrival_time) <
return a.unwrapped_sequence_number < b.unwrapped_sequence_number; std::tie(b.ssrc, b.unwrapped_sequence_number, b.arrival_time);
}
return a.ssrc < b.ssrc;
}); });
uint32_t compact_ntp = uint32_t compact_ntp =
CompactNtp(env_.clock().ConvertTimestampToNtpTime(now)); CompactNtp(env_.clock().ConvertTimestampToNtpTime(now));

View File

@ -301,8 +301,7 @@ TEST(CongestionControlFeedbackGeneratorTest,
generator.Process(clock.CurrentTime()); generator.Process(clock.CurrentTime());
} }
// TODO: bugs.webrtc.org/42225697 - Figure out why this test is flaky. TEST(CongestionControlFeedbackGeneratorTest,
TEST(DISABLED_CongestionControlFeedbackGeneratorTest,
ReportsFirstReceivedPacketArrivalTimeButEcnFromCePacketIfDuplicate) { ReportsFirstReceivedPacketArrivalTimeButEcnFromCePacketIfDuplicate) {
MockFunction<void(std::vector<std::unique_ptr<rtcp::RtcpPacket>>)> MockFunction<void(std::vector<std::unique_ptr<rtcp::RtcpPacket>>)>
rtcp_sender; rtcp_sender;