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

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: Loss masks are parameters to NetworkReceivedPackets. fec_ is not dynamically allocated. Created 4 years, 5 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
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 ecaa86e5d2f38fc26ccf382cd623949226a915b3..770889b99ff5e967d31b967ee031a85d2aaae338 100644
--- a/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
+++ b/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc
@@ -544,11 +544,12 @@ void ForwardErrorCorrection::InsertFecPacket(
for (uint16_t bit_idx = 0; bit_idx < 8; ++bit_idx) {
if (packet_mask & (1 << (7 - bit_idx))) {
ProtectedPacket* protected_packet = new ProtectedPacket();
- fec_packet->protected_pkt_list.push_back(protected_packet);
// This wraps naturally with the sequence number.
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 by construction.
stefan-webrtc 2016/07/20 09:33:30 Sorted by sequence number?
brandtr 2016/07/21 09:04:33 Yep.
+ fec_packet->protected_pkt_list.push_back(protected_packet);
}
}
}
@@ -560,6 +561,10 @@ void ForwardErrorCorrection::InsertFecPacket(
AssignRecoveredPackets(fec_packet, recovered_packet_list);
// 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 (see decoding algorithm in AttemptRecover()), but
+ // by keeping it sorted we try to recover the oldest lost packets first.
stefan-webrtc 2016/07/20 09:33:30 Perhaps mention how it's ordered too.
brandtr 2016/07/21 09:04:33 Done.
fec_packet_list_.push_back(fec_packet);
fec_packet_list_.sort(SortablePacket::LessThan);
if (fec_packet_list_.size() > kMaxFecPackets) {
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc » ('j') | webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698