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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Returns true if all calls to Create succeeded. A buffer of size | 84 // Returns true if all calls to Create succeeded. A buffer of size |
85 // IP_PACKET_SIZE will be allocated and reused between calls to callback. | 85 // IP_PACKET_SIZE will be allocated and reused between calls to callback. |
86 bool Build(PacketReadyCallback* callback) const; | 86 bool Build(PacketReadyCallback* callback) const; |
87 | 87 |
88 // Returns true if all calls to Create succeeded. Provided buffer reference | 88 // Returns true if all calls to Create succeeded. Provided buffer reference |
89 // will be used for all calls to callback. | 89 // will be used for all calls to callback. |
90 bool BuildExternalBuffer(uint8_t* buffer, | 90 bool BuildExternalBuffer(uint8_t* buffer, |
91 size_t max_length, | 91 size_t max_length, |
92 PacketReadyCallback* callback) const; | 92 PacketReadyCallback* callback) const; |
93 | 93 |
| 94 // Size of this packet in bytes (including headers, excluding nested packets). |
| 95 virtual size_t BlockLength() const = 0; |
| 96 |
94 protected: | 97 protected: |
95 RtcpPacket() {} | 98 RtcpPacket() {} |
96 | 99 |
97 virtual bool Create(uint8_t* packet, | 100 virtual bool Create(uint8_t* packet, |
98 size_t* index, | 101 size_t* index, |
99 size_t max_length, | 102 size_t max_length, |
100 PacketReadyCallback* callback) const = 0; | 103 PacketReadyCallback* callback) const = 0; |
101 | 104 |
102 static void CreateHeader(uint8_t count_or_format, | 105 static void CreateHeader(uint8_t count_or_format, |
103 uint8_t packet_type, | 106 uint8_t packet_type, |
104 size_t block_length, // Size in 32bit words - 1. | 107 size_t block_length, // Size in 32bit words - 1. |
105 uint8_t* buffer, | 108 uint8_t* buffer, |
106 size_t* pos); | 109 size_t* pos); |
107 | 110 |
108 bool OnBufferFull(uint8_t* packet, | 111 bool OnBufferFull(uint8_t* packet, |
109 size_t* index, | 112 size_t* index, |
110 RtcpPacket::PacketReadyCallback* callback) const; | 113 RtcpPacket::PacketReadyCallback* callback) const; |
111 | 114 |
112 virtual size_t BlockLength() const = 0; | |
113 size_t HeaderLength() const; | 115 size_t HeaderLength() const; |
114 | 116 |
115 static const size_t kHeaderLength = 4; | 117 static const size_t kHeaderLength = 4; |
116 | 118 |
117 private: | 119 private: |
118 bool CreateAndAddAppended(uint8_t* packet, | 120 bool CreateAndAddAppended(uint8_t* packet, |
119 size_t* index, | 121 size_t* index, |
120 size_t max_length, | 122 size_t max_length, |
121 PacketReadyCallback* callback) const; | 123 PacketReadyCallback* callback) const; |
122 | 124 |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 | 1157 |
1156 private: | 1158 private: |
1157 const size_t buffer_length_; | 1159 const size_t buffer_length_; |
1158 size_t length_; | 1160 size_t length_; |
1159 rtc::scoped_ptr<uint8_t[]> buffer_; | 1161 rtc::scoped_ptr<uint8_t[]> buffer_; |
1160 }; | 1162 }; |
1161 | 1163 |
1162 } // namespace rtcp | 1164 } // namespace rtcp |
1163 } // namespace webrtc | 1165 } // namespace webrtc |
1164 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ | 1166 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ |
OLD | NEW |