tmmbr.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_TMMBR_H_
  11. #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_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 Request (TMMBR).
  19. // RFC 5104, Section 4.2.1.
  20. class Tmmbr : public Rtpfb {
  21. public:
  22. static constexpr uint8_t kFeedbackMessageType = 3;
  23. Tmmbr();
  24. ~Tmmbr() 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>& requests() 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.
  36. void SetMediaSsrc(uint32_t ssrc);
  37. std::vector<TmmbItem> items_;
  38. };
  39. } // namespace rtcp
  40. } // namespace webrtc
  41. #endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_