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