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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 EXPECT_EQ(seq_num, (data[2] << 8) + data[3]); | 42 EXPECT_EQ(seq_num, (data[2] << 8) + data[3]); |
43 uint32_t parsed_timestamp = (data[4] << 24) + (data[5] << 16) + | 43 uint32_t parsed_timestamp = (data[4] << 24) + (data[5] << 16) + |
44 (data[6] << 8) + data[7]; | 44 (data[6] << 8) + data[7]; |
45 EXPECT_EQ(timestamp, parsed_timestamp); | 45 EXPECT_EQ(timestamp, parsed_timestamp); |
46 EXPECT_EQ(static_cast<uint8_t>(fec_payload_type), data[kRtpHeaderSize]); | 46 EXPECT_EQ(static_cast<uint8_t>(fec_payload_type), data[kRtpHeaderSize]); |
47 } | 47 } |
48 | 48 |
49 class ProducerFecTest : public ::testing::Test { | 49 class ProducerFecTest : public ::testing::Test { |
50 protected: | 50 protected: |
51 ProducerFec producer_; | 51 ProducerFec producer_; |
52 test::fec::FrameGenerator generator_; | 52 test::fec::UlpfecPacketGenerator generator_; |
53 }; | 53 }; |
54 | 54 |
55 // Verifies bug found via fuzzing, where a gap in the packet sequence caused us | 55 // Verifies bug found via fuzzing, where a gap in the packet sequence caused us |
56 // to move past the end of the current FEC packet mask byte without moving to | 56 // to move past the end of the current FEC packet mask byte without moving to |
57 // the next byte. That likely caused us to repeatedly read from the same byte, | 57 // the next byte. That likely caused us to repeatedly read from the same byte, |
58 // and if that byte didn't protect packets we would generate empty FEC. | 58 // and if that byte didn't protect packets we would generate empty FEC. |
59 TEST_F(ProducerFecTest, NoEmptyFecWithSeqNumGaps) { | 59 TEST_F(ProducerFecTest, NoEmptyFecWithSeqNumGaps) { |
60 struct Packet { | 60 struct Packet { |
61 size_t header_size; | 61 size_t header_size; |
62 size_t payload_size; | 62 size_t payload_size; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 VerifyHeader(packet->header.header.sequenceNumber, | 180 VerifyHeader(packet->header.header.sequenceNumber, |
181 packet->header.header.timestamp, kRedPayloadType, | 181 packet->header.header.timestamp, kRedPayloadType, |
182 packet->header.header.payloadType, red_packet.get(), | 182 packet->header.header.payloadType, red_packet.get(), |
183 true); // Marker bit set. | 183 true); // Marker bit set. |
184 for (int i = 0; i < 10; ++i) | 184 for (int i = 0; i < 10; ++i) |
185 EXPECT_EQ(i, red_packet->data()[kRtpHeaderSize + 1 + i]); | 185 EXPECT_EQ(i, red_packet->data()[kRtpHeaderSize + 1 + i]); |
186 delete packet; | 186 delete packet; |
187 } | 187 } |
188 | 188 |
189 } // namespace webrtc | 189 } // namespace webrtc |
OLD | NEW |