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 20 matching lines...) Expand all Loading... |
31 constexpr uint32_t kMediaSsrc = 835424; | 31 constexpr uint32_t kMediaSsrc = 835424; |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 void VerifyHeader(uint16_t seq_num, | 34 void VerifyHeader(uint16_t seq_num, |
35 uint32_t timestamp, | 35 uint32_t timestamp, |
36 int red_payload_type, | 36 int red_payload_type, |
37 int fec_payload_type, | 37 int fec_payload_type, |
38 RedPacket* packet, | 38 RedPacket* packet, |
39 bool marker_bit) { | 39 bool marker_bit) { |
40 EXPECT_GT(packet->length(), kRtpHeaderSize); | 40 EXPECT_GT(packet->length(), kRtpHeaderSize); |
41 EXPECT_TRUE(packet->data() != NULL); | 41 EXPECT_TRUE(packet->data() != nullptr); |
42 uint8_t* data = packet->data(); | 42 uint8_t* data = packet->data(); |
43 // Marker bit not set. | 43 // Marker bit not set. |
44 EXPECT_EQ(marker_bit ? 0x80 : 0, data[1] & 0x80); | 44 EXPECT_EQ(marker_bit ? 0x80 : 0, data[1] & 0x80); |
45 EXPECT_EQ(red_payload_type, data[1] & 0x7F); | 45 EXPECT_EQ(red_payload_type, data[1] & 0x7F); |
46 EXPECT_EQ(seq_num, (data[2] << 8) + data[3]); | 46 EXPECT_EQ(seq_num, (data[2] << 8) + data[3]); |
47 uint32_t parsed_timestamp = | 47 uint32_t parsed_timestamp = |
48 (data[4] << 24) + (data[5] << 16) + (data[6] << 8) + data[7]; | 48 (data[4] << 24) + (data[5] << 16) + (data[6] << 8) + data[7]; |
49 EXPECT_EQ(timestamp, parsed_timestamp); | 49 EXPECT_EQ(timestamp, parsed_timestamp); |
50 EXPECT_EQ(static_cast<uint8_t>(fec_payload_type), data[kRtpHeaderSize]); | 50 EXPECT_EQ(static_cast<uint8_t>(fec_payload_type), data[kRtpHeaderSize]); |
51 } | 51 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 packet->data, packet->length - kRtpHeaderSize, kRtpHeaderSize, | 195 packet->data, packet->length - kRtpHeaderSize, kRtpHeaderSize, |
196 kRedPayloadType); | 196 kRedPayloadType); |
197 EXPECT_EQ(packet->length + kRedForFecHeaderLength, red_packet->length()); | 197 EXPECT_EQ(packet->length + kRedForFecHeaderLength, red_packet->length()); |
198 VerifyHeader(packet->header.header.sequenceNumber, | 198 VerifyHeader(packet->header.header.sequenceNumber, |
199 packet->header.header.timestamp, kRedPayloadType, | 199 packet->header.header.timestamp, kRedPayloadType, |
200 packet->header.header.payloadType, red_packet.get(), | 200 packet->header.header.payloadType, red_packet.get(), |
201 true); // Marker bit set. | 201 true); // Marker bit set. |
202 } | 202 } |
203 | 203 |
204 } // namespace webrtc | 204 } // namespace webrtc |
OLD | NEW |