| 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 | |
| 97 protected: | 94 protected: |
| 98 RtcpPacket() {} | 95 RtcpPacket() {} |
| 99 | 96 |
| 100 virtual bool Create(uint8_t* packet, | 97 virtual bool Create(uint8_t* packet, |
| 101 size_t* index, | 98 size_t* index, |
| 102 size_t max_length, | 99 size_t max_length, |
| 103 PacketReadyCallback* callback) const = 0; | 100 PacketReadyCallback* callback) const = 0; |
| 104 | 101 |
| 105 static void CreateHeader(uint8_t count_or_format, | 102 static void CreateHeader(uint8_t count_or_format, |
| 106 uint8_t packet_type, | 103 uint8_t packet_type, |
| 107 size_t block_length, // Size in 32bit words - 1. | 104 size_t block_length, // Size in 32bit words - 1. |
| 108 uint8_t* buffer, | 105 uint8_t* buffer, |
| 109 size_t* pos); | 106 size_t* pos); |
| 110 | 107 |
| 111 bool OnBufferFull(uint8_t* packet, | 108 bool OnBufferFull(uint8_t* packet, |
| 112 size_t* index, | 109 size_t* index, |
| 113 RtcpPacket::PacketReadyCallback* callback) const; | 110 RtcpPacket::PacketReadyCallback* callback) const; |
| 114 | 111 |
| 112 virtual size_t BlockLength() const = 0; |
| 115 size_t HeaderLength() const; | 113 size_t HeaderLength() const; |
| 116 | 114 |
| 117 static const size_t kHeaderLength = 4; | 115 static const size_t kHeaderLength = 4; |
| 118 | 116 |
| 119 private: | 117 private: |
| 120 bool CreateAndAddAppended(uint8_t* packet, | 118 bool CreateAndAddAppended(uint8_t* packet, |
| 121 size_t* index, | 119 size_t* index, |
| 122 size_t max_length, | 120 size_t max_length, |
| 123 PacketReadyCallback* callback) const; | 121 PacketReadyCallback* callback) const; |
| 124 | 122 |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 | 1155 |
| 1158 private: | 1156 private: |
| 1159 const size_t buffer_length_; | 1157 const size_t buffer_length_; |
| 1160 size_t length_; | 1158 size_t length_; |
| 1161 rtc::scoped_ptr<uint8_t[]> buffer_; | 1159 rtc::scoped_ptr<uint8_t[]> buffer_; |
| 1162 }; | 1160 }; |
| 1163 | 1161 |
| 1164 } // namespace rtcp | 1162 } // namespace rtcp |
| 1165 } // namespace webrtc | 1163 } // namespace webrtc |
| 1166 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ | 1164 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ |
| OLD | NEW |