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

Unified Diff: webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc

Issue 2893293003: Only compare sequence numbers from the same SSRC in ForwardErrorCorrection. (Closed)
Patch Set: Typo fix. Created 3 years, 7 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/ulpfec_receiver_impl.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/test/testFec/test_fec.cc
diff --git a/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc b/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc
index 4aaae9885284669cff87da837a5b40baae9fd542..922fe2f9a548d0bb4692e9defd2a6679bab5e6cd 100644
--- a/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc
+++ b/webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc
@@ -78,13 +78,7 @@ void ReceivePackets(
}
}
-// Too slow to finish before timeout on iOS. See webrtc:4755.
-#if defined(WEBRTC_IOS)
-#define MAYBE_FecTest DISABLED_FecTest
-#else
-#define MAYBE_FecTest FecTest
-#endif
-TEST(FecTest, MAYBE_FecTest) {
+void RunTest(bool use_flexfec) {
// TODO(marpan): Split this function into subroutines/helper functions.
enum { kMaxNumberMediaPackets = 48 };
enum { kMaxNumberFecPackets = 48 };
@@ -107,8 +101,13 @@ TEST(FecTest, MAYBE_FecTest) {
ASSERT_EQ(12, kMaxMediaPackets[1]) << "Max media packets for bursty mode not "
<< "equal to 12.";
- std::unique_ptr<ForwardErrorCorrection> fec =
- ForwardErrorCorrection::CreateUlpfec();
+ std::unique_ptr<ForwardErrorCorrection> fec;
+ if (use_flexfec) {
+ fec = ForwardErrorCorrection::CreateFlexfec();
+ } else {
+ fec = ForwardErrorCorrection::CreateUlpfec();
+ }
+
ForwardErrorCorrection::PacketList media_packet_list;
std::list<ForwardErrorCorrection::Packet*> fec_packet_list;
ForwardErrorCorrection::ReceivedPacketList to_decode_list;
@@ -138,7 +137,16 @@ TEST(FecTest, MAYBE_FecTest) {
uint16_t seq_num = 0;
uint32_t timestamp = random.Rand<uint32_t>();
- const uint32_t ssrc = random.Rand(1u, 0xfffffffe);
+ const uint32_t media_ssrc = random.Rand(1u, 0xfffffffe);
+ uint32_t fec_ssrc;
+ uint16_t fec_seq_num_offset;
+ if (use_flexfec) {
+ fec_ssrc = random.Rand(1u, 0xfffffffe);
+ fec_seq_num_offset = random.Rand<uint16_t>();
+ } else {
+ fec_ssrc = media_ssrc;
+ fec_seq_num_offset = 0;
+ }
// Loop over the mask types: random and bursty.
for (int mask_type_idx = 0; mask_type_idx < kNumFecMaskTypes;
@@ -268,7 +276,7 @@ TEST(FecTest, MAYBE_FecTest) {
ByteWriter<uint32_t>::WriteBigEndian(&media_packet->data[4],
timestamp);
ByteWriter<uint32_t>::WriteBigEndian(&media_packet->data[8],
- ssrc);
+ media_ssrc);
// Generate random values for payload
for (size_t j = 12; j < media_packet->length; ++j) {
media_packet->data[j] = random.Rand<uint8_t>();
@@ -302,6 +310,7 @@ TEST(FecTest, MAYBE_FecTest) {
received_packet->pkt->length = media_packet->length;
memcpy(received_packet->pkt->data, media_packet->data,
media_packet->length);
+ received_packet->ssrc = media_ssrc;
received_packet->seq_num =
ByteReader<uint16_t>::ReadBigEndian(&media_packet->data[2]);
received_packet->is_fec = false;
@@ -323,9 +332,9 @@ TEST(FecTest, MAYBE_FecTest) {
received_packet->pkt->length = fec_packet->length;
memcpy(received_packet->pkt->data, fec_packet->data,
fec_packet->length);
- received_packet->seq_num = seq_num;
+ received_packet->seq_num = fec_seq_num_offset + seq_num;
received_packet->is_fec = true;
- received_packet->ssrc = ssrc;
+ received_packet->ssrc = fec_ssrc;
received_packet_list.push_back(std::move(received_packet));
fec_mask_list.push_back(fec_packet_masks[fec_packet_idx]);
@@ -453,5 +462,21 @@ TEST(FecTest, MAYBE_FecTest) {
<< "Recovered packet list is not empty";
}
+// Too slow to finish before timeout on iOS. See webrtc:4755.
+#if defined(WEBRTC_IOS)
+#define MAYBE_UlpecTest DISABLED_UlpecTest
+#define MAYBE_FlexfecTest DISABLED_FlexfecTest
+#else
+#define MAYBE_UlpecTest UlpecTest
+#define MAYBE_FlexfecTest FlexfecTest
+#endif
+TEST(FecTest, MAYBE_UlpecTest) {
+ RunTest(false);
+}
+
+TEST(FecTest, MAYBE_FlexfecTest) {
+ RunTest(true);
+}
+
} // namespace test
} // namespace webrtc
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698