| OLD | NEW |
| 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 <algorithm> | 11 #include <algorithm> |
| 12 | 12 |
| 13 #include "webrtc/base/basictypes.h" | 13 #include "webrtc/base/basictypes.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/include/flexfec_receiver.h" | 15 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" |
| 16 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 16 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 17 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" | |
| 18 | 17 |
| 19 namespace webrtc { | 18 namespace webrtc { |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 class DummyCallback : public RecoveredPacketReceiver { | 21 class DummyCallback : public RecoveredPacketReceiver { |
| 23 bool OnRecoveredPacket(const uint8_t* packet, size_t length) { return true; } | 22 bool OnRecoveredPacket(const uint8_t* packet, size_t length) { return true; } |
| 24 }; | 23 }; |
| 25 } // namespace | 24 } // namespace |
| 26 | 25 |
| 27 void FuzzOneInput(const uint8_t* data, size_t size) { | 26 void FuzzOneInput(const uint8_t* data, size_t size) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 55 i += packet_length; | 54 i += packet_length; |
| 56 if (i < size && data[i++] % 2 == 0) { | 55 if (i < size && data[i++] % 2 == 0) { |
| 57 // Simulate FlexFEC packet. | 56 // Simulate FlexFEC packet. |
| 58 ByteWriter<uint16_t>::WriteBigEndian(packet.get() + 2, flexfec_seq_num++); | 57 ByteWriter<uint16_t>::WriteBigEndian(packet.get() + 2, flexfec_seq_num++); |
| 59 ByteWriter<uint32_t>::WriteBigEndian(packet.get() + 8, flexfec_ssrc); | 58 ByteWriter<uint32_t>::WriteBigEndian(packet.get() + 8, flexfec_ssrc); |
| 60 } else { | 59 } else { |
| 61 // Simulate media packet. | 60 // Simulate media packet. |
| 62 ByteWriter<uint16_t>::WriteBigEndian(packet.get() + 2, media_seq_num++); | 61 ByteWriter<uint16_t>::WriteBigEndian(packet.get() + 2, media_seq_num++); |
| 63 ByteWriter<uint32_t>::WriteBigEndian(packet.get() + 8, media_ssrc); | 62 ByteWriter<uint32_t>::WriteBigEndian(packet.get() + 8, media_ssrc); |
| 64 } | 63 } |
| 65 RtpPacketReceived parsed_packet; | 64 receiver.AddAndProcessReceivedPacket(packet.get(), packet_length); |
| 66 if (parsed_packet.Parse(packet.get(), packet_length)) { | |
| 67 receiver.AddAndProcessReceivedPacket(parsed_packet); | |
| 68 } | |
| 69 } | 65 } |
| 70 } | 66 } |
| 71 | 67 |
| 72 } // namespace webrtc | 68 } // namespace webrtc |
| OLD | NEW |