| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 size_t source_count = 1 + csrcs_.size(); | 407 size_t source_count = 1 + csrcs_.size(); |
| 408 return kHeaderLength + 4 * source_count; | 408 return kHeaderLength + 4 * source_count; |
| 409 } | 409 } |
| 410 | 410 |
| 411 RTCPUtility::RTCPPacketBYE bye_; | 411 RTCPUtility::RTCPPacketBYE bye_; |
| 412 std::vector<uint32_t> csrcs_; | 412 std::vector<uint32_t> csrcs_; |
| 413 | 413 |
| 414 RTC_DISALLOW_COPY_AND_ASSIGN(Bye); | 414 RTC_DISALLOW_COPY_AND_ASSIGN(Bye); |
| 415 }; | 415 }; |
| 416 | 416 |
| 417 // Application-Defined packet (APP) (RFC 3550). | |
| 418 // | |
| 419 // 0 1 2 3 | |
| 420 // 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 | |
| 421 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 422 // |V=2|P| subtype | PT=APP=204 | length | | |
| 423 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 424 // | SSRC/CSRC | | |
| 425 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 426 // | name (ASCII) | | |
| 427 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 428 // | application-dependent data ... | |
| 429 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 430 | |
| 431 class App : public RtcpPacket { | |
| 432 public: | |
| 433 App() | |
| 434 : RtcpPacket(), | |
| 435 ssrc_(0) { | |
| 436 memset(&app_, 0, sizeof(app_)); | |
| 437 } | |
| 438 | |
| 439 virtual ~App() {} | |
| 440 | |
| 441 void From(uint32_t ssrc) { | |
| 442 ssrc_ = ssrc; | |
| 443 } | |
| 444 void WithSubType(uint8_t subtype) { | |
| 445 assert(subtype <= 0x1f); | |
| 446 app_.SubType = subtype; | |
| 447 } | |
| 448 void WithName(uint32_t name) { | |
| 449 app_.Name = name; | |
| 450 } | |
| 451 void WithData(const uint8_t* data, uint16_t data_length) { | |
| 452 assert(data); | |
| 453 assert(data_length <= kRtcpAppCode_DATA_SIZE); | |
| 454 assert(data_length % 4 == 0); | |
| 455 memcpy(app_.Data, data, data_length); | |
| 456 app_.Size = data_length; | |
| 457 } | |
| 458 | |
| 459 protected: | |
| 460 bool Create(uint8_t* packet, | |
| 461 size_t* index, | |
| 462 size_t max_length, | |
| 463 RtcpPacket::PacketReadyCallback* callback) const override; | |
| 464 | |
| 465 private: | |
| 466 size_t BlockLength() const { | |
| 467 return 12 + app_.Size; | |
| 468 } | |
| 469 | |
| 470 uint32_t ssrc_; | |
| 471 RTCPUtility::RTCPPacketAPP app_; | |
| 472 | |
| 473 RTC_DISALLOW_COPY_AND_ASSIGN(App); | |
| 474 }; | |
| 475 | |
| 476 // RFC 4585: Feedback format. | 417 // RFC 4585: Feedback format. |
| 477 // | 418 // |
| 478 // Common packet format: | 419 // Common packet format: |
| 479 // | 420 // |
| 480 // 0 1 2 3 | 421 // 0 1 2 3 |
| 481 // 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 | 422 // 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 |
| 482 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 423 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 483 // |V=2|P| FMT | PT | length | | 424 // |V=2|P| FMT | PT | length | |
| 484 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 425 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 485 // | SSRC of packet sender | | 426 // | SSRC of packet sender | |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 | 1042 |
| 1102 private: | 1043 private: |
| 1103 const size_t buffer_length_; | 1044 const size_t buffer_length_; |
| 1104 size_t length_; | 1045 size_t length_; |
| 1105 rtc::scoped_ptr<uint8_t[]> buffer_; | 1046 rtc::scoped_ptr<uint8_t[]> buffer_; |
| 1106 }; | 1047 }; |
| 1107 | 1048 |
| 1108 } // namespace rtcp | 1049 } // namespace rtcp |
| 1109 } // namespace webrtc | 1050 } // namespace webrtc |
| 1110 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ | 1051 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ |
| OLD | NEW |