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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 private: | 413 private: |
414 static const int kMaxNumberOfChunks = 0x1f; | 414 static const int kMaxNumberOfChunks = 0x1f; |
415 | 415 |
416 size_t BlockLength() const; | 416 size_t BlockLength() const; |
417 | 417 |
418 std::vector<Chunk> chunks_; | 418 std::vector<Chunk> chunks_; |
419 | 419 |
420 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes); | 420 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes); |
421 }; | 421 }; |
422 | 422 |
423 // | |
424 // Bye packet (BYE) (RFC 3550). | |
425 // | |
426 // 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 | |
427 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
428 // |V=2|P| SC | PT=BYE=203 | length | | |
429 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
430 // | SSRC/CSRC | | |
431 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
432 // : ... : | |
433 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | |
434 // (opt) | length | reason for leaving ... | |
435 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
436 | |
437 class Bye : public RtcpPacket { | |
438 public: | |
439 Bye() : RtcpPacket() { | |
440 memset(&bye_, 0, sizeof(bye_)); | |
441 } | |
442 | |
443 virtual ~Bye() {} | |
444 | |
445 void From(uint32_t ssrc) { | |
446 bye_.SenderSSRC = ssrc; | |
447 } | |
448 | |
449 bool WithCsrc(uint32_t csrc); | |
450 | |
451 // TODO(sprang): Add support for reason field? | |
452 | |
453 protected: | |
454 bool Create(uint8_t* packet, | |
455 size_t* index, | |
456 size_t max_length, | |
457 RtcpPacket::PacketReadyCallback* callback) const override; | |
458 | |
459 private: | |
460 static const int kMaxNumberOfCsrcs = 0x1f - 1; // First item is sender SSRC. | |
461 | |
462 size_t BlockLength() const { | |
463 size_t source_count = 1 + csrcs_.size(); | |
464 return kHeaderLength + 4 * source_count; | |
465 } | |
466 | |
467 RTCPUtility::RTCPPacketBYE bye_; | |
468 std::vector<uint32_t> csrcs_; | |
469 | |
470 RTC_DISALLOW_COPY_AND_ASSIGN(Bye); | |
471 }; | |
472 | |
473 // Application-Defined packet (APP) (RFC 3550). | 423 // Application-Defined packet (APP) (RFC 3550). |
474 // | 424 // |
475 // 0 1 2 3 | 425 // 0 1 2 3 |
476 // 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 | 426 // 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 |
477 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 427 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
478 // |V=2|P| subtype | PT=APP=204 | length | | 428 // |V=2|P| subtype | PT=APP=204 | length | |
479 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 429 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
480 // | SSRC/CSRC | | 430 // | SSRC/CSRC | |
481 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 431 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
482 // | name (ASCII) | | 432 // | name (ASCII) | |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 | 1107 |
1158 private: | 1108 private: |
1159 const size_t buffer_length_; | 1109 const size_t buffer_length_; |
1160 size_t length_; | 1110 size_t length_; |
1161 rtc::scoped_ptr<uint8_t[]> buffer_; | 1111 rtc::scoped_ptr<uint8_t[]> buffer_; |
1162 }; | 1112 }; |
1163 | 1113 |
1164 } // namespace rtcp | 1114 } // namespace rtcp |
1165 } // namespace webrtc | 1115 } // namespace webrtc |
1166 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ | 1116 #endif // WEBRTC_MODULES_RTP_RTCP_RTCP_PACKET_H_ |
OLD | NEW |