blob: 9b2eca1869698d23458937e26da4ab812d03dbd8 [file] [log] [blame]
danilchap7e8145f2016-01-11 11:49:19 -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.
danilchap7e8145f2016-01-11 11:49:19 -08009 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_
12#define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_
danilchap7e8145f2016-01-11 11:49:19 -080013
danilchapf174e3a2016-02-05 04:56:36 -080014#include <vector>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
17#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
18#include "rtc_base/basictypes.h"
danilchap7e8145f2016-01-11 11:49:19 -080019
20namespace webrtc {
21namespace rtcp {
danilchap6ce1adc2016-05-26 05:29:14 -070022class CommonHeader;
23
danilchapf174e3a2016-02-05 04:56:36 -080024// Temporary Maximum Media Stream Bit Rate Request (TMMBR).
25// RFC 5104, Section 4.2.1.
26class Tmmbr : public Rtpfb {
danilchap7e8145f2016-01-11 11:49:19 -080027 public:
danilchap6ce1adc2016-05-26 05:29:14 -070028 static constexpr uint8_t kFeedbackMessageType = 3;
danilchap7e8145f2016-01-11 11:49:19 -080029
eladalon8fa21c42017-06-16 07:07:47 -070030 Tmmbr();
31 ~Tmmbr() override;
danilchap7e8145f2016-01-11 11:49:19 -080032
danilchapf174e3a2016-02-05 04:56:36 -080033 // Parse assumes header is already parsed and validated.
danilchap6ce1adc2016-05-26 05:29:14 -070034 bool Parse(const CommonHeader& packet);
danilchapf174e3a2016-02-05 04:56:36 -080035
danilchap822a16f2016-09-27 09:27:47 -070036 void AddTmmbr(const TmmbItem& item);
danilchapf174e3a2016-02-05 04:56:36 -080037
38 const std::vector<TmmbItem>& requests() const { return items_; }
danilchap7e8145f2016-01-11 11:49:19 -080039
eladalon8fa21c42017-06-16 07:07:47 -070040 size_t BlockLength() const override;
41
danilchap7e8145f2016-01-11 11:49:19 -080042 bool Create(uint8_t* packet,
43 size_t* index,
44 size_t max_length,
45 RtcpPacket::PacketReadyCallback* callback) const override;
46
47 private:
danilchap1b1863a2016-09-20 01:39:54 -070048 // Media ssrc is unused, shadow base class setter.
danilchap822a16f2016-09-27 09:27:47 -070049 void SetMediaSsrc(uint32_t ssrc);
danilchapf174e3a2016-02-05 04:56:36 -080050
51 std::vector<TmmbItem> items_;
danilchap7e8145f2016-01-11 11:49:19 -080052};
53} // namespace rtcp
54} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020055#endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_