| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 * | |
| 10 */ | 9 */ |
| 11 | 10 |
| 12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ |
| 13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ |
| 14 | 13 |
| 15 #include <string> | 14 #include <string> |
| 16 #include <vector> | 15 #include <vector> |
| 17 | 16 |
| 18 #include "webrtc/base/basictypes.h" | 17 #include "webrtc/base/basictypes.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
| 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 21 | 20 |
| 22 namespace webrtc { | 21 namespace webrtc { |
| 23 namespace rtcp { | 22 namespace rtcp { |
| 24 // Source Description (SDES) (RFC 3550). | 23 // Source Description (SDES) (RFC 3550). |
| 25 class Sdes : public RtcpPacket { | 24 class Sdes : public RtcpPacket { |
| 26 public: | 25 public: |
| 27 Sdes() : RtcpPacket() {} | 26 struct Chunk { |
| 27 uint32_t ssrc; |
| 28 std::string cname; |
| 29 }; |
| 30 static const uint8_t kPacketType = 202; |
| 28 | 31 |
| 29 virtual ~Sdes() {} | 32 Sdes(); |
| 33 ~Sdes() override; |
| 34 |
| 35 // Parse assumes header is already parsed and validated. |
| 36 bool Parse(const RTCPUtility::RtcpCommonHeader& header, |
| 37 const uint8_t* payload); // Size of the payload is in the header. |
| 30 | 38 |
| 31 bool WithCName(uint32_t ssrc, const std::string& cname); | 39 bool WithCName(uint32_t ssrc, const std::string& cname); |
| 32 | 40 |
| 33 struct Chunk { | 41 const std::vector<Chunk>& chunks() const { return chunks_; } |
| 34 uint32_t ssrc; | 42 |
| 35 std::string name; | 43 size_t BlockLength() const override { return block_length_; } |
| 36 int null_octets; | |
| 37 }; | |
| 38 | 44 |
| 39 protected: | 45 protected: |
| 40 bool Create(uint8_t* packet, | 46 bool Create(uint8_t* packet, |
| 41 size_t* index, | 47 size_t* index, |
| 42 size_t max_length, | 48 size_t max_length, |
| 43 RtcpPacket::PacketReadyCallback* callback) const override; | 49 RtcpPacket::PacketReadyCallback* callback) const override; |
| 44 | 50 |
| 45 private: | 51 private: |
| 46 static const int kMaxNumberOfChunks = 0x1f; | 52 static const size_t kMaxNumberOfChunks = 0x1f; |
| 47 | |
| 48 size_t BlockLength() const; | |
| 49 | 53 |
| 50 std::vector<Chunk> chunks_; | 54 std::vector<Chunk> chunks_; |
| 55 size_t block_length_; |
| 51 | 56 |
| 52 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes); | 57 RTC_DISALLOW_COPY_AND_ASSIGN(Sdes); |
| 53 }; | 58 }; |
| 54 } // namespace rtcp | 59 } // namespace rtcp |
| 55 } // namespace webrtc | 60 } // namespace webrtc |
| 56 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ | 61 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ |
| OLD | NEW |