sdes.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_
  11. #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_
  12. #include <string>
  13. #include <vector>
  14. #include "modules/rtp_rtcp/source/rtcp_packet.h"
  15. namespace webrtc {
  16. namespace rtcp {
  17. class CommonHeader;
  18. // Source Description (SDES) (RFC 3550).
  19. class Sdes : public RtcpPacket {
  20. public:
  21. struct Chunk {
  22. uint32_t ssrc;
  23. std::string cname;
  24. };
  25. static constexpr uint8_t kPacketType = 202;
  26. static constexpr size_t kMaxNumberOfChunks = 0x1f;
  27. Sdes();
  28. ~Sdes() override;
  29. // Parse assumes header is already parsed and validated.
  30. bool Parse(const CommonHeader& packet);
  31. bool AddCName(uint32_t ssrc, std::string cname);
  32. const std::vector<Chunk>& chunks() const { return chunks_; }
  33. size_t BlockLength() const override;
  34. bool Create(uint8_t* packet,
  35. size_t* index,
  36. size_t max_length,
  37. PacketReadyCallback callback) const override;
  38. private:
  39. std::vector<Chunk> chunks_;
  40. size_t block_length_;
  41. };
  42. } // namespace rtcp
  43. } // namespace webrtc
  44. #endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SDES_H_