philipel | ea142f8 | 2017-01-11 02:01:56 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/video_coding/packet_buffer.h" |
| 12 | #include "system_wrappers/include/clock.h" |
philipel | 0c87e29 | 2018-05-17 16:44:47 +0200 | [diff] [blame] | 13 | #include "test/fuzzers/fuzz_data_helper.h" |
philipel | ea142f8 | 2017-01-11 02:01:56 -0800 | [diff] [blame] | 14 | |
| 15 | namespace webrtc { |
philipel | ea142f8 | 2017-01-11 02:01:56 -0800 | [diff] [blame] | 16 | namespace { |
| 17 | class NullCallback : public video_coding::OnReceivedFrameCallback { |
| 18 | void OnReceivedFrame(std::unique_ptr<video_coding::RtpFrameObject> frame) {} |
| 19 | }; |
| 20 | } // namespace |
| 21 | |
| 22 | void FuzzOneInput(const uint8_t* data, size_t size) { |
philipel | ea142f8 | 2017-01-11 02:01:56 -0800 | [diff] [blame] | 23 | VCMPacket packet; |
| 24 | NullCallback callback; |
| 25 | SimulatedClock clock(0); |
| 26 | rtc::scoped_refptr<video_coding::PacketBuffer> packet_buffer( |
| 27 | video_coding::PacketBuffer::Create(&clock, 8, 1024, &callback)); |
philipel | 0c87e29 | 2018-05-17 16:44:47 +0200 | [diff] [blame] | 28 | test::FuzzDataHelper helper(rtc::ArrayView<const uint8_t>(data, size)); |
philipel | ea142f8 | 2017-01-11 02:01:56 -0800 | [diff] [blame] | 29 | |
philipel | 0c87e29 | 2018-05-17 16:44:47 +0200 | [diff] [blame] | 30 | while (helper.BytesLeft()) |
| 31 | helper.CopyTo(&packet); |
philipel | ea142f8 | 2017-01-11 02:01:56 -0800 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | } // namespace webrtc |