remb.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_REMB_H_
  11. #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_REMB_H_
  12. #include <vector>
  13. #include "modules/rtp_rtcp/source/rtcp_packet/psfb.h"
  14. namespace webrtc {
  15. namespace rtcp {
  16. class CommonHeader;
  17. // Receiver Estimated Max Bitrate (REMB) (draft-alvestrand-rmcat-remb).
  18. class Remb : public Psfb {
  19. public:
  20. static constexpr size_t kMaxNumberOfSsrcs = 0xff;
  21. Remb();
  22. Remb(const Remb&);
  23. ~Remb() override;
  24. // Parse assumes header is already parsed and validated.
  25. bool Parse(const CommonHeader& packet);
  26. bool SetSsrcs(std::vector<uint32_t> ssrcs);
  27. void SetBitrateBps(int64_t bitrate_bps) { bitrate_bps_ = bitrate_bps; }
  28. int64_t bitrate_bps() const { return bitrate_bps_; }
  29. const std::vector<uint32_t>& ssrcs() const { return ssrcs_; }
  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 constexpr uint32_t kUniqueIdentifier = 0x52454D42; // 'R' 'E' 'M' 'B'.
  37. // Media ssrc is unused, shadow base class setter and getter.
  38. void SetMediaSsrc(uint32_t);
  39. uint32_t media_ssrc() const;
  40. int64_t bitrate_bps_;
  41. std::vector<uint32_t> ssrcs_;
  42. };
  43. } // namespace rtcp
  44. } // namespace webrtc
  45. #endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_REMB_H_