bye.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2015 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_BYE_H_
  12. #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_BYE_H_
  13. #include <string>
  14. #include <vector>
  15. #include "modules/rtp_rtcp/source/rtcp_packet.h"
  16. namespace webrtc {
  17. namespace rtcp {
  18. class CommonHeader;
  19. class Bye : public RtcpPacket {
  20. public:
  21. static constexpr uint8_t kPacketType = 203;
  22. Bye();
  23. ~Bye() override;
  24. // Parse assumes header is already parsed and validated.
  25. bool Parse(const CommonHeader& packet);
  26. bool SetCsrcs(std::vector<uint32_t> csrcs);
  27. void SetReason(std::string reason);
  28. const std::vector<uint32_t>& csrcs() const { return csrcs_; }
  29. const std::string& reason() const { return reason_; }
  30. size_t BlockLength() const override;
  31. bool Create(uint8_t* packet,
  32. size_t* index,
  33. size_t max_length,
  34. PacketReadyCallback callback) const override;
  35. private:
  36. static const int kMaxNumberOfCsrcs = 0x1f - 1; // First item is sender SSRC.
  37. std::vector<uint32_t> csrcs_;
  38. std::string reason_;
  39. };
  40. } // namespace rtcp
  41. } // namespace webrtc
  42. #endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_BYE_H_