| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 private: | 243 private: |
| 244 static const int kMaxNumberOfChunks = 0x1f; | 244 static const int kMaxNumberOfChunks = 0x1f; |
| 245 | 245 |
| 246 size_t BlockLength() const; | 246 size_t BlockLength() const; |
| 247 | 247 |
| 248 std::vector<Chunk> chunks_; | 248 std::vector<Chunk> chunks_; |
| 249 | 249 |
| 250 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes); | 250 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes); |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 // Reference picture selection indication (RPSI) (RFC 4585). | |
| 254 // | |
| 255 // FCI: | |
| 256 // | |
| 257 // 0 1 2 3 | |
| 258 // 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 | |
| 259 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 260 // | PB |0| Payload Type| Native RPSI bit string | | |
| 261 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 262 // | defined per codec ... | Padding (0) | | |
| 263 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 264 | |
| 265 class Rpsi : public RtcpPacket { | |
| 266 public: | |
| 267 Rpsi() | |
| 268 : RtcpPacket(), | |
| 269 padding_bytes_(0) { | |
| 270 memset(&rpsi_, 0, sizeof(rpsi_)); | |
| 271 } | |
| 272 | |
| 273 virtual ~Rpsi() {} | |
| 274 | |
| 275 void From(uint32_t ssrc) { | |
| 276 rpsi_.SenderSSRC = ssrc; | |
| 277 } | |
| 278 void To(uint32_t ssrc) { | |
| 279 rpsi_.MediaSSRC = ssrc; | |
| 280 } | |
| 281 void WithPayloadType(uint8_t payload) { | |
| 282 assert(payload <= 0x7f); | |
| 283 rpsi_.PayloadType = payload; | |
| 284 } | |
| 285 void WithPictureId(uint64_t picture_id); | |
| 286 | |
| 287 protected: | |
| 288 bool Create(uint8_t* packet, | |
| 289 size_t* index, | |
| 290 size_t max_length, | |
| 291 RtcpPacket::PacketReadyCallback* callback) const override; | |
| 292 | |
| 293 private: | |
| 294 size_t BlockLength() const { | |
| 295 size_t fci_length = 2 + (rpsi_.NumberOfValidBits / 8) + padding_bytes_; | |
| 296 return kCommonFbFmtLength + fci_length; | |
| 297 } | |
| 298 | |
| 299 uint8_t padding_bytes_; | |
| 300 RTCPUtility::RTCPPacketPSFBRPSI rpsi_; | |
| 301 | |
| 302 RTC_DISALLOW_COPY_AND_ASSIGN(Rpsi); | |
| 303 }; | |
| 304 | |
| 305 // Class holding a RTCP packet. | 253 // Class holding a RTCP packet. |
| 306 // | 254 // |
| 307 // Takes a built rtcp packet. | 255 // Takes a built rtcp packet. |
| 308 // RawPacket raw_packet(buffer, length); | 256 // RawPacket raw_packet(buffer, length); |
| 309 // | 257 // |
| 310 // To access the raw packet: | 258 // To access the raw packet: |
| 311 // raw_packet.Buffer(); - pointer to the raw packet | 259 // raw_packet.Buffer(); - pointer to the raw packet |
| 312 // raw_packet.BufferLength(); - the length of the raw packet | 260 // raw_packet.BufferLength(); - the length of the raw packet |
| 313 | 261 |
| 314 class RawPacket { | 262 class RawPacket { |
| 315 public: | 263 public: |
| 316 explicit RawPacket(size_t buffer_length); | 264 explicit RawPacket(size_t buffer_length); |
| 317 RawPacket(const uint8_t* packet, size_t packet_length); | 265 RawPacket(const uint8_t* packet, size_t packet_length); |
| 318 | 266 |
| 319 const uint8_t* Buffer() const; | 267 const uint8_t* Buffer() const; |
| 320 uint8_t* MutableBuffer(); | 268 uint8_t* MutableBuffer(); |
| 321 size_t BufferLength() const; | 269 size_t BufferLength() const; |
| 322 size_t Length() const; | 270 size_t Length() const; |
| 323 void SetLength(size_t length); | 271 void SetLength(size_t length); |
| 324 | 272 |
| 325 private: | 273 private: |
| 326 const size_t buffer_length_; | 274 const size_t buffer_length_; |
| 327 size_t length_; | 275 size_t length_; |
| 328 rtc::scoped_ptr<uint8_t[]> buffer_; | 276 rtc::scoped_ptr<uint8_t[]> buffer_; |
| 329 }; | 277 }; |
| 330 | 278 |
| 331 } // namespace rtcp | 279 } // namespace rtcp |
| 332 } // namespace webrtc | 280 } // namespace webrtc |
| 333 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ | 281 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_H_ |
| OLD | NEW |