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