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

Side by Side Diff: webrtc/test/fuzzers/producer_fec_fuzzer.cc

Issue 1922283002: Fix producer_fec_fuzzer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 #include "webrtc/base/checks.h" 10 #include "webrtc/base/checks.h"
11 #include "webrtc/base/scoped_ptr.h" 11 #include "webrtc/base/scoped_ptr.h"
12 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 12 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
13 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h" 13 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h"
14 14
15 namespace webrtc { 15 namespace webrtc {
16 16
17 void FuzzOneInput(const uint8_t* data, size_t size) { 17 void FuzzOneInput(const uint8_t* data, size_t size) {
18 ForwardErrorCorrection fec; 18 ForwardErrorCorrection fec;
19 ProducerFec producer(&fec); 19 ProducerFec producer(&fec);
20 size_t i = 0; 20 size_t i = 0;
21 if (size < 4) 21 if (size < 4)
22 return; 22 return;
23 FecProtectionParams params = {data[i++] % 128, data[i++] % 2 == 1, 23 FecProtectionParams params = {
24 static_cast<int>(data[i++] % 10), 24 data[i++] % 128, static_cast<int>(data[i++] % 10), kFecMaskBursty};
25 kFecMaskBursty};
26 producer.SetFecParameters(&params, 0); 25 producer.SetFecParameters(&params, 0);
27 uint16_t seq_num = data[i++]; 26 uint16_t seq_num = data[i++];
28 27
29 while (i + 3 < size) { 28 while (i + 3 < size) {
30 size_t rtp_header_length = data[i++] % 10 + 12; 29 size_t rtp_header_length = data[i++] % 10 + 12;
31 size_t payload_size = data[i++] % 10; 30 size_t payload_size = data[i++] % 10;
32 if (i + payload_size + rtp_header_length + 2 > size) 31 if (i + payload_size + rtp_header_length + 2 > size)
33 break; 32 break;
34 rtc::scoped_ptr<uint8_t[]> packet( 33 rtc::scoped_ptr<uint8_t[]> packet(
35 new uint8_t[payload_size + rtp_header_length]); 34 new uint8_t[payload_size + rtp_header_length]);
(...skipping 13 matching lines...) Expand all
49 if (num_fec_packets > 0) { 48 if (num_fec_packets > 0) {
50 std::vector<RedPacket*> fec_packets = 49 std::vector<RedPacket*> fec_packets =
51 producer.GetFecPackets(kRedPayloadType, 99, 100, rtp_header_length); 50 producer.GetFecPackets(kRedPayloadType, 99, 100, rtp_header_length);
52 RTC_CHECK_EQ(num_fec_packets, fec_packets.size()); 51 RTC_CHECK_EQ(num_fec_packets, fec_packets.size());
53 for (RedPacket* fec_packet : fec_packets) 52 for (RedPacket* fec_packet : fec_packets)
54 delete fec_packet; 53 delete fec_packet;
55 } 54 }
56 } 55 }
57 } 56 }
58 } // namespace webrtc 57 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698