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