1 /* 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ 12 #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ 13 14 #include <string> 15 #include <vector> 16 17 #include "modules/rtp_rtcp/source/rtcp_packet.h" 18 19 namespace webrtc { 20 namespace rtcp { 21 class CommonHeader; 22 // Source Description (SDES) (RFC 3550). 23 class Sdes : public RtcpPacket { 24 public: 25 struct Chunk { 26 uint32_t ssrc; 27 std::string cname; 28 }; 29 static constexpr uint8_t kPacketType = 202; 30 static constexpr size_t kMaxNumberOfChunks = 0x1f; 31 32 Sdes(); 33 ~Sdes() override; 34 35 // Parse assumes header is already parsed and validated. 36 bool Parse(const CommonHeader& packet); 37 38 bool AddCName(uint32_t ssrc, std::string cname); 39 chunks()40 const std::vector<Chunk>& chunks() const { return chunks_; } 41 42 size_t BlockLength() const override; 43 44 bool Create(uint8_t* packet, 45 size_t* index, 46 size_t max_length, 47 PacketReadyCallback callback) const override; 48 49 private: 50 std::vector<Chunk> chunks_; 51 size_t block_length_; 52 }; 53 } // namespace rtcp 54 } // namespace webrtc 55 #endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_ 56