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_TMMB_ITEM_H_
12 : #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMB_ITEM_H_
13 :
14 : #include "webrtc/base/basictypes.h"
15 :
16 : namespace webrtc {
17 : namespace rtcp {
18 : // RFC5104, Section 3.5.4
19 : // Temporary Maximum Media Stream Bitrate Request/Notification.
20 : // Used both by TMMBR and TMMBN rtcp packets.
21 : class TmmbItem {
22 : public:
23 : static const size_t kLength = 8;
24 :
25 0 : TmmbItem() : ssrc_(0), bitrate_bps_(0), packet_overhead_(0) {}
26 : TmmbItem(uint32_t ssrc, uint64_t bitrate_bps, uint16_t overhead);
27 :
28 : bool Parse(const uint8_t* buffer);
29 : void Create(uint8_t* buffer) const;
30 :
31 0 : void set_ssrc(uint32_t ssrc) { ssrc_ = ssrc; }
32 0 : void set_bitrate_bps(uint64_t bitrate_bps) { bitrate_bps_ = bitrate_bps; }
33 : void set_packet_overhead(uint16_t overhead);
34 :
35 0 : uint32_t ssrc() const { return ssrc_; }
36 0 : uint64_t bitrate_bps() const { return bitrate_bps_; }
37 0 : uint16_t packet_overhead() const { return packet_overhead_; }
38 :
39 : private:
40 : // Media stream id.
41 : uint32_t ssrc_;
42 : // Maximum total media bit rate that the media receiver is
43 : // currently prepared to accept for this media stream.
44 : uint64_t bitrate_bps_;
45 : // Per-packet overhead that the media receiver has observed
46 : // for this media stream at its chosen reference protocol layer.
47 : uint16_t packet_overhead_;
48 : };
49 : } // namespace rtcp
50 : } // namespace webrtc
51 : #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMB_ITEM_H_
|