Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: webrtc/modules/rtp_rtcp/source/forward_error_correction.cc

Issue 2101253002: Unit test for media packet reordering in ForwardErrorCorrection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@flexfec-pt1c_renames-and-fixes
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
diff --git a/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc b/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
index 63c6d688c09e1f9315b7a77a1a98d0552bb2d6d5..6bc80e95d2d4b99d09c977a0d6c05f87227f1497 100644
--- a/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
+++ b/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
@@ -523,6 +523,8 @@ void ForwardErrorCorrection::InsertFecPacket(
protected_packet->seq_num =
static_cast<uint16_t>(seq_num_base + (byte_idx << 3) + bit_idx);
protected_packet->pkt = nullptr;
+ // Note that |protected_pkt_list| is sorted (according to sequence
+ // number) by construction.
fec_packet->protected_packets.push_back(std::move(protected_packet));
}
}
@@ -534,6 +536,11 @@ void ForwardErrorCorrection::InsertFecPacket(
AssignRecoveredPackets(fec_packet.get(), recovered_packets);
// TODO(holmer): Consider replacing this with a binary search for the right
// position, and then just insert the new packet. Would get rid of the sort.
+ //
+ // For correct decoding, |fec_packet_list_| does not necessarily
+ // need to be sorted by sequence number (see decoding algorithm in
+ // AttemptRecover()), but by keeping it sorted we try to recover the
+ // oldest lost packets first.
received_fec_packets_.push_back(std::move(fec_packet));
received_fec_packets_.sort(SortablePacket::LessThan());
if (received_fec_packets_.size() > kMaxFecPackets) {
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698