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

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

Issue 2867713003: Remove hardcoded kValueSizeBytes values from variable-length header extensions. (Closed)
Patch Set: Patch 7 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 unified diff | Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc ('k') | webrtc/video/video_send_stream.cc » ('j') | 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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
11 #include <memory> 11 #include <memory>
12 12
13 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" 13 #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
14 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 14 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
15 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" 15 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
16 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 16 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
17 #include "webrtc/system_wrappers/include/clock.h" 17 #include "webrtc/system_wrappers/include/clock.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 namespace { 21 namespace {
22 22
23 constexpr int kFlexfecPayloadType = 123; 23 constexpr int kFlexfecPayloadType = 123;
24 constexpr uint32_t kMediaSsrc = 1234; 24 constexpr uint32_t kMediaSsrc = 1234;
25 constexpr uint32_t kFlexfecSsrc = 5678; 25 constexpr uint32_t kFlexfecSsrc = 5678;
26 const std::vector<RtpExtension> kNoRtpHeaderExtensions; 26 const std::vector<RtpExtension> kNoRtpHeaderExtensions;
27 const std::vector<RtpExtensionSize> kNoRtpHeaderExtensionSizes;
27 28
28 } // namespace 29 } // namespace
29 30
30 void FuzzOneInput(const uint8_t* data, size_t size) { 31 void FuzzOneInput(const uint8_t* data, size_t size) {
31 size_t i = 0; 32 size_t i = 0;
32 if (size < 5) { 33 if (size < 5) {
33 return; 34 return;
34 } 35 }
35 36
36 SimulatedClock clock(1 + data[i++]); 37 SimulatedClock clock(1 + data[i++]);
37 FlexfecSender sender(kFlexfecPayloadType, kFlexfecSsrc, kMediaSsrc, 38 FlexfecSender sender(kFlexfecPayloadType, kFlexfecSsrc, kMediaSsrc,
38 kNoRtpHeaderExtensions, &clock); 39 kNoRtpHeaderExtensions, kNoRtpHeaderExtensionSizes,
erikvarga1 2017/05/11 12:59:38 I've added the missing new param to the FlexfecSen
40 &clock);
39 FecProtectionParams params = { 41 FecProtectionParams params = {
40 data[i++], static_cast<int>(data[i++] % 100), 42 data[i++], static_cast<int>(data[i++] % 100),
41 data[i++] <= 127 ? kFecMaskRandom : kFecMaskBursty}; 43 data[i++] <= 127 ? kFecMaskRandom : kFecMaskBursty};
42 sender.SetFecParameters(params); 44 sender.SetFecParameters(params);
43 uint16_t seq_num = data[i++]; 45 uint16_t seq_num = data[i++];
44 46
45 while (i + 1 < size) { 47 while (i + 1 < size) {
46 // Everything past the base RTP header (12 bytes) is payload, 48 // Everything past the base RTP header (12 bytes) is payload,
47 // from the perspective of FlexFEC. 49 // from the perspective of FlexFEC.
48 size_t payload_size = data[i++]; 50 size_t payload_size = data[i++];
(...skipping 10 matching lines...) Expand all
59 break; 61 break;
60 sender.AddRtpPacketAndGenerateFec(rtp_packet); 62 sender.AddRtpPacketAndGenerateFec(rtp_packet);
61 if (sender.FecAvailable()) { 63 if (sender.FecAvailable()) {
62 std::vector<std::unique_ptr<RtpPacketToSend>> fec_packets = 64 std::vector<std::unique_ptr<RtpPacketToSend>> fec_packets =
63 sender.GetFecPackets(); 65 sender.GetFecPackets();
64 } 66 }
65 } 67 }
66 } 68 }
67 69
68 } // namespace webrtc 70 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc ('k') | webrtc/video/video_send_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698