OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 if (*index == 0) | 43 if (*index == 0) |
44 return false; | 44 return false; |
45 RTC_DCHECK(callback) << "Fragmentation not supported."; | 45 RTC_DCHECK(callback) << "Fragmentation not supported."; |
46 callback->OnPacketReady(packet, *index); | 46 callback->OnPacketReady(packet, *index); |
47 *index = 0; | 47 *index = 0; |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 size_t RtcpPacket::HeaderLength() const { | 51 size_t RtcpPacket::HeaderLength() const { |
52 size_t length_in_bytes = BlockLength(); | 52 size_t length_in_bytes = BlockLength(); |
53 RTC_DCHECK_GT(length_in_bytes, 0u); | 53 RTC_DCHECK_GT(length_in_bytes, 0); |
54 RTC_DCHECK_EQ(length_in_bytes % 4, 0u) << "Padding not supported"; | 54 RTC_DCHECK_EQ(length_in_bytes % 4, 0) << "Padding not supported"; |
55 // Length in 32-bit words without common header. | 55 // Length in 32-bit words without common header. |
56 return (length_in_bytes - kHeaderLength) / 4; | 56 return (length_in_bytes - kHeaderLength) / 4; |
57 } | 57 } |
58 | 58 |
59 // From RFC 3550, RTP: A Transport Protocol for Real-Time Applications. | 59 // From RFC 3550, RTP: A Transport Protocol for Real-Time Applications. |
60 // | 60 // |
61 // RTP header format. | 61 // RTP header format. |
62 // 0 1 2 3 | 62 // 0 1 2 3 |
63 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | 63 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
64 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 64 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
(...skipping 11 matching lines...) Expand all Loading... |
76 constexpr uint8_t kNoPaddingBit = 0 << 5; | 76 constexpr uint8_t kNoPaddingBit = 0 << 5; |
77 buffer[*pos + 0] = kVersionBits | kNoPaddingBit | count_or_format; | 77 buffer[*pos + 0] = kVersionBits | kNoPaddingBit | count_or_format; |
78 buffer[*pos + 1] = packet_type; | 78 buffer[*pos + 1] = packet_type; |
79 buffer[*pos + 2] = (length >> 8) & 0xff; | 79 buffer[*pos + 2] = (length >> 8) & 0xff; |
80 buffer[*pos + 3] = length & 0xff; | 80 buffer[*pos + 3] = length & 0xff; |
81 *pos += kHeaderLength; | 81 *pos += kHeaderLength; |
82 } | 82 } |
83 | 83 |
84 } // namespace rtcp | 84 } // namespace rtcp |
85 } // namespace webrtc | 85 } // namespace webrtc |
OLD | NEW |