tmmbn.h 1.6 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_TMMBN_H_
  11. #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
  12. #include <vector>
  13. #include "modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
  14. #include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
  15. namespace webrtc {
  16. namespace rtcp {
  17. class CommonHeader;
  18. // Temporary Maximum Media Stream Bit Rate Notification (TMMBN).
  19. // RFC 5104, Section 4.2.2.
  20. class Tmmbn : public Rtpfb {
  21. public:
  22. static constexpr uint8_t kFeedbackMessageType = 4;
  23. Tmmbn();
  24. ~Tmmbn() override;
  25. // Parse assumes header is already parsed and validated.
  26. bool Parse(const CommonHeader& packet);
  27. void AddTmmbr(const TmmbItem& item);
  28. const std::vector<TmmbItem>& items() const { return items_; }
  29. size_t BlockLength() const override;
  30. bool Create(uint8_t* packet,
  31. size_t* index,
  32. size_t max_length,
  33. PacketReadyCallback callback) const override;
  34. private:
  35. // Media ssrc is unused, shadow base class setter and getter.
  36. void SetMediaSsrc(uint32_t ssrc);
  37. uint32_t media_ssrc() const;
  38. std::vector<TmmbItem> items_;
  39. };
  40. } // namespace rtcp
  41. } // namespace webrtc
  42. #endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_