blob: 3a06e44a1ea40e1d0c45f31a6bec0117a902f3c9 [file] [log] [blame]
danilchapef3d8052016-01-11 03:31:08 -08001/*
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.
danilchapef3d8052016-01-11 03:31:08 -08009 */
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>
danilchap7336eeb2016-02-08 03:35:10 -080015
danilchap7336eeb2016-02-08 03:35:10 -080016#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
17#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020018#include "webrtc/rtc_base/basictypes.h"
danilchapef3d8052016-01-11 03:31:08 -080019
20namespace webrtc {
21namespace rtcp {
danilchap6ce1adc2016-05-26 05:29:14 -070022class CommonHeader;
23
danilchap7336eeb2016-02-08 03:35:10 -080024// Temporary Maximum Media Stream Bit Rate Notification (TMMBN).
25// RFC 5104, Section 4.2.2.
26class Tmmbn : public Rtpfb {
danilchapef3d8052016-01-11 03:31:08 -080027 public:
danilchap6ce1adc2016-05-26 05:29:14 -070028 static constexpr uint8_t kFeedbackMessageType = 4;
danilchapef3d8052016-01-11 03:31:08 -080029
eladalon8fa21c42017-06-16 07:07:47 -070030 Tmmbn();
31 ~Tmmbn() override;
danilchapef3d8052016-01-11 03:31:08 -080032
danilchap7336eeb2016-02-08 03:35:10 -080033 // Parse assumes header is already parsed and validated.
danilchap6ce1adc2016-05-26 05:29:14 -070034 bool Parse(const CommonHeader& packet);
danilchap7336eeb2016-02-08 03:35:10 -080035
danilchap822a16f2016-09-27 09:27:47 -070036 void AddTmmbr(const TmmbItem& item);
danilchap7336eeb2016-02-08 03:35:10 -080037
38 const std::vector<TmmbItem>& items() const { return items_; }
danilchapef3d8052016-01-11 03:31:08 -080039
eladalon8fa21c42017-06-16 07:07:47 -070040 size_t BlockLength() const override;
41
danilchapef3d8052016-01-11 03:31:08 -080042 bool Create(uint8_t* packet,
43 size_t* index,
44 size_t max_length,
45 RtcpPacket::PacketReadyCallback* callback) const override;
46
47 private:
danilchap7336eeb2016-02-08 03:35:10 -080048 // Media ssrc is unused, shadow base class setter and getter.
danilchap822a16f2016-09-27 09:27:47 -070049 void SetMediaSsrc(uint32_t ssrc);
danilchap7336eeb2016-02-08 03:35:10 -080050 uint32_t media_ssrc() const;
51
52 std::vector<TmmbItem> items_;
danilchapef3d8052016-01-11 03:31:08 -080053};
danilchapef3d8052016-01-11 03:31:08 -080054} // namespace rtcp
55} // namespace webrtc
56#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_