OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 EXPECT_EQ(red_payload_type, data[1] & 0x7F); | 34 EXPECT_EQ(red_payload_type, data[1] & 0x7F); |
35 EXPECT_EQ(seq_num, (data[2] << 8) + data[3]); | 35 EXPECT_EQ(seq_num, (data[2] << 8) + data[3]); |
36 uint32_t parsed_timestamp = (data[4] << 24) + (data[5] << 16) + | 36 uint32_t parsed_timestamp = (data[4] << 24) + (data[5] << 16) + |
37 (data[6] << 8) + data[7]; | 37 (data[6] << 8) + data[7]; |
38 EXPECT_EQ(timestamp, parsed_timestamp); | 38 EXPECT_EQ(timestamp, parsed_timestamp); |
39 EXPECT_EQ(static_cast<uint8_t>(fec_payload_type), data[kRtpHeaderSize]); | 39 EXPECT_EQ(static_cast<uint8_t>(fec_payload_type), data[kRtpHeaderSize]); |
40 } | 40 } |
41 | 41 |
42 class ProducerFecTest : public ::testing::Test { | 42 class ProducerFecTest : public ::testing::Test { |
43 protected: | 43 protected: |
44 ProducerFecTest() : producer_(&fec_) {} | |
45 | |
46 ForwardErrorCorrection fec_; | |
47 ProducerFec producer_; | 44 ProducerFec producer_; |
48 FrameGenerator generator_; | 45 FrameGenerator generator_; |
49 }; | 46 }; |
50 | 47 |
51 // Verifies bug found via fuzzing, where a gap in the packet sequence caused us | 48 // Verifies bug found via fuzzing, where a gap in the packet sequence caused us |
52 // to move past the end of the current FEC packet mask byte without moving to | 49 // to move past the end of the current FEC packet mask byte without moving to |
53 // the next byte. That likely caused us to repeatedly read from the same byte, | 50 // the next byte. That likely caused us to repeatedly read from the same byte, |
54 // and if that byte didn't protect packets we would generate empty FEC. | 51 // and if that byte didn't protect packets we would generate empty FEC. |
55 TEST_F(ProducerFecTest, NoEmptyFecWithSeqNumGaps) { | 52 TEST_F(ProducerFecTest, NoEmptyFecWithSeqNumGaps) { |
56 struct Packet { | 53 struct Packet { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 ProducerFec::BuildRedPacket(packet->data, packet->length - kRtpHeaderSize, | 194 ProducerFec::BuildRedPacket(packet->data, packet->length - kRtpHeaderSize, |
198 kRtpHeaderSize, kRedPayloadType); | 195 kRtpHeaderSize, kRedPayloadType); |
199 EXPECT_EQ(packet->length + kRedForFecHeaderLength, red_packet->length()); | 196 EXPECT_EQ(packet->length + kRedForFecHeaderLength, red_packet->length()); |
200 VerifyHeader(packet->header.header.sequenceNumber, | 197 VerifyHeader(packet->header.header.sequenceNumber, |
201 packet->header.header.timestamp, kRedPayloadType, | 198 packet->header.header.timestamp, kRedPayloadType, |
202 packet->header.header.payloadType, red_packet.get(), | 199 packet->header.header.payloadType, red_packet.get(), |
203 true); // Marker bit set. | 200 true); // Marker bit set. |
204 } | 201 } |
205 | 202 |
206 } // namespace webrtc | 203 } // namespace webrtc |
OLD | NEW |