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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/producer_fec_unittest.cc

Issue 1522463002: Add FEC producer fuzzing and a unittest for one of the issues found. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed fuzzer to have reasonable sequence numbers Created 5 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 virtual void TearDown() { 47 virtual void TearDown() {
48 delete producer_; 48 delete producer_;
49 delete fec_; 49 delete fec_;
50 delete generator_; 50 delete generator_;
51 } 51 }
52 ForwardErrorCorrection* fec_; 52 ForwardErrorCorrection* fec_;
53 ProducerFec* producer_; 53 ProducerFec* producer_;
54 FrameGenerator* generator_; 54 FrameGenerator* generator_;
55 }; 55 };
56 56
57 TEST_F(ProducerFecTest, FuzzOneInput) {
58 uint8_t data[] = {
59 0xf9, 0x36, 0x70, 0xc2, 0xfb, 0x28, 0x21, 0x21, 0x47, 0x3b, 0x36, 0x70,
60 0xca, 0xcf, 0xff, 0x21, 0x21, 0x45, 0x3b, 0xb6, 0x2a, 0x27, 0xd6, 0x3a,
61 0xa2, 0x27, 0x21, 0x5c, 0x3a, 0x49, 0x9b, 0x1b, 0x29, 0x84, 0x3a, 0x3a,
62 0x27, 0x54, 0x58, 0x3b, 0x28, 0xf4, 0x28, 0x27, 0x3b, 0x21, 0x3b, 0x3a,
63 0xcb, 0xc0, 0xc7, 0x29, 0x21, 0x76, 0xe6, 0x28, 0x7d, 0x97, 0x2a, 0x28,
64 0x7d, 0x28, 0x97, 0x2a, 0x29, 0x64, 0x3b, 0x1d, 0x7d, 0x56, 0xc7, 0x21,
65 0xd9, 0x12, 0x55, 0xa5, 0x28, 0x7d, 0x97, 0x2a, 0x28, 0x7d, 0x28, 0x97,
66 0x2a, 0x29, 0x64, 0x3b, 0x1d, 0x7d, 0x56, 0xc7, 0x5, 0xd9, 0x12, 0x79,
67 0x55, 0xa5, 0x56, 0xfe, 0x3a, 0x3, 0x37, 0x3b, 0x3a, 0x2a, 0x2a, 0xc7,
68 0x2c, 0x3a, 0xd1, 0xa2, 0x2a, 0x90, 0x2c, 0x21, 0x2a, 0x3b, 0x28, 0x8b,
69 0xfc, 0x3b, 0x46, 0x3b, 0xa2, 0x3b, 0x3b, 0x2a, 0x3b, 0x3b, 0x28, 0x29,
70 0xe, 0x3a, 0x2a, 0xa2, 0x46, 0x8b, 0x28, 0xff, 0x29, 0x29, 0x1, 0x8f,
71 0x9, 0x74, 0x57, 0x2a, 0x34, 0x3b, 0x3b, 0x3, 0xf0, 0x87, 0x3b, 0xfc,
72 0x5e, 0x29, 0x3b, 0x5c, 0x1a, 0xf8, 0x28, 0xcd, 0xe3, 0x98, 0x84, 0x7f,
73 0x87, 0x5f, 0x3a, 0x64, 0x1f, 0x28, 0x3b, 0x1d, 0x7d, 0x96, 0xf0, 0xc7};
74 FuzzOneInput(data, sizeof(data));
pbos-webrtc 2015/12/11 13:31:45 Could you unpack this test to have the actual mean
stefan-webrtc 2015/12/11 14:26:26 Done.
75 }
76
57 TEST_F(ProducerFecTest, OneFrameFec) { 77 TEST_F(ProducerFecTest, OneFrameFec) {
58 // The number of media packets (|kNumPackets|), number of frames (one for 78 // The number of media packets (|kNumPackets|), number of frames (one for
59 // this test), and the protection factor (|params->fec_rate|) are set to make 79 // this test), and the protection factor (|params->fec_rate|) are set to make
60 // sure the conditions for generating FEC are satisfied. This means: 80 // sure the conditions for generating FEC are satisfied. This means:
61 // (1) protection factor is high enough so that actual overhead over 1 frame 81 // (1) protection factor is high enough so that actual overhead over 1 frame
62 // of packets is within |kMaxExcessOverhead|, and (2) the total number of 82 // of packets is within |kMaxExcessOverhead|, and (2) the total number of
63 // media packets for 1 frame is at least |minimum_media_packets_fec_|. 83 // media packets for 1 frame is at least |minimum_media_packets_fec_|.
64 const int kNumPackets = 4; 84 const int kNumPackets = 4;
65 FecProtectionParams params = {15, false, 3}; 85 FecProtectionParams params = {15, false, 3};
66 std::list<RtpPacket*> rtp_packets; 86 std::list<RtpPacket*> rtp_packets;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 kRedPayloadType, 167 kRedPayloadType,
148 packet->header.header.payloadType, 168 packet->header.header.payloadType,
149 red_packet.get(), 169 red_packet.get(),
150 true); // Marker bit set. 170 true); // Marker bit set.
151 for (int i = 0; i < 10; ++i) 171 for (int i = 0; i < 10; ++i)
152 EXPECT_EQ(i, red_packet->data()[kRtpHeaderSize + 1 + i]); 172 EXPECT_EQ(i, red_packet->data()[kRtpHeaderSize + 1 + i]);
153 delete packet; 173 delete packet;
154 } 174 }
155 175
156 } // namespace webrtc 176 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/forward_error_correction.cc ('k') | webrtc/test/fuzzers/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698