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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.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 on "1c". Created 4 years, 6 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 | « webrtc/modules/rtp_rtcp/source/forward_error_correction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc
index f830354342b8eaaffcc47a03409ad40801ce87f4..82a32a2420ed17b2dba68f980557b168d909cc07 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc
@@ -201,7 +201,7 @@ TEST_F(RtpFecTest, FecRecoveryWithSeqNumGapTwoFrames) {
EXPECT_TRUE(recovered_packet_list_.size() != media_packet_list_.size());
}
-// Verify we can still recovery frame if sequence number wrap occurs within
+// Verify we can still recover frame if sequence number wrap occurs within
// the frame and FEC packet following wrap is received after media packets.
TEST_F(RtpFecTest, FecRecoveryWithSeqNumGapOneFrameRecovery) {
const int kNumImportantPackets = 0;
@@ -281,7 +281,44 @@ TEST_F(RtpFecTest, FecRecoveryWithSeqNumGapOneFrameNoRecovery) {
EXPECT_FALSE(IsRecoveryComplete());
}
-// Verify we can still recovery frame if FEC is received before media packets.
+// Verify we can still recover frame if media packets are reordered.
+TEST_F(RtpFecTest, FecRecoveryWithMediaReordering) {
+ const int kNumImportantPackets = 0;
danilchap 2016/07/01 18:55:08 might want change to constexpr, but may leave as c
brandtr 2016/07/04 13:56:07 Done.
+ const bool kUseUnequalProtection = false;
+ uint8_t kProtectionFactor = 20;
danilchap 2016/07/01 18:55:08 const
brandtr 2016/07/04 13:56:07 Done.
+
+ // One frame: 3 media packets, 1 FEC packet.
+ // -----Frame 1----
+ // #0(media) #1(media) #2(media) #3(FEC).
+ fec_seq_num_ = ConstructMediaPacketsSeqNum(3, 0);
+
+ EXPECT_EQ(0, fec_->GenerateFec(media_packet_list_, kProtectionFactor,
+ kNumImportantPackets, kUseUnequalProtection,
+ webrtc::kFecMaskBursty, &fec_packet_list_));
+
+ // Expect 1 FEC packet.
+ EXPECT_EQ(1, static_cast<int>(fec_packet_list_.size()));
danilchap 2016/07/01 18:55:08 EXPECT_EQ(1u, fec_packet_list_.size()); is cleaner
brandtr 2016/07/04 13:56:07 Done.
+
+ // Lose one media packet (seq# 1).
+ memset(media_loss_mask_, 0, sizeof(media_loss_mask_));
+ memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_));
+ media_loss_mask_[1] = 1;
+ NetworkReceivedPackets();
+
+ // Reorder received media packets.
+ auto it0 = received_packet_list_.begin();
+ auto it2 = received_packet_list_.begin(); it2++;
danilchap 2016/07/01 18:55:08 do not keep two commands on one line
brandtr 2016/07/04 13:56:07 Done.
+ std::swap(*it0, *it2);
+
+ EXPECT_EQ(0,
+ fec_->DecodeFec(&received_packet_list_, &recovered_packet_list_));
+
+ // Expect 3 media packets in recovered list, and complete recovery.
+ EXPECT_EQ(3, static_cast<int>(recovered_packet_list_.size()));
danilchap 2016/07/01 18:55:08 EXPECT_EQ(3u, ...)
brandtr 2016/07/04 13:56:07 Done.
+ EXPECT_TRUE(IsRecoveryComplete());
+}
+
+// Verify we can still recover frame if FEC is received before media packets.
TEST_F(RtpFecTest, FecRecoveryWithFecOutOfOrder) {
const int kNumImportantPackets = 0;
const bool kUseUnequalProtection = false;
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/forward_error_correction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698