blob: ff7779d8ace236c2a1dd35bc547b94f0c22b20ae [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
12#define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
danilchapef3d8052016-01-11 03:31:08 -080013
14#include <vector>
danilchap7336eeb2016-02-08 03:35:10 -080015
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"
danilchapef3d8052016-01-11 03:31:08 -080018
19namespace webrtc {
20namespace rtcp {
danilchap6ce1adc2016-05-26 05:29:14 -070021class CommonHeader;
22
danilchap7336eeb2016-02-08 03:35:10 -080023// Temporary Maximum Media Stream Bit Rate Notification (TMMBN).
24// RFC 5104, Section 4.2.2.
25class Tmmbn : public Rtpfb {
danilchapef3d8052016-01-11 03:31:08 -080026 public:
danilchap6ce1adc2016-05-26 05:29:14 -070027 static constexpr uint8_t kFeedbackMessageType = 4;
danilchapef3d8052016-01-11 03:31:08 -080028
eladalon8fa21c42017-06-16 07:07:47 -070029 Tmmbn();
30 ~Tmmbn() override;
danilchapef3d8052016-01-11 03:31:08 -080031
danilchap7336eeb2016-02-08 03:35:10 -080032 // Parse assumes header is already parsed and validated.
danilchap6ce1adc2016-05-26 05:29:14 -070033 bool Parse(const CommonHeader& packet);
danilchap7336eeb2016-02-08 03:35:10 -080034
danilchap822a16f2016-09-27 09:27:47 -070035 void AddTmmbr(const TmmbItem& item);
danilchap7336eeb2016-02-08 03:35:10 -080036
37 const std::vector<TmmbItem>& items() const { return items_; }
danilchapef3d8052016-01-11 03:31:08 -080038
eladalon8fa21c42017-06-16 07:07:47 -070039 size_t BlockLength() const override;
40
danilchapef3d8052016-01-11 03:31:08 -080041 bool Create(uint8_t* packet,
42 size_t* index,
43 size_t max_length,
Danil Chapovalov5c3cc412017-12-07 10:15:53 +010044 PacketReadyCallback callback) const override;
danilchapef3d8052016-01-11 03:31:08 -080045
46 private:
danilchap7336eeb2016-02-08 03:35:10 -080047 // Media ssrc is unused, shadow base class setter and getter.
danilchap822a16f2016-09-27 09:27:47 -070048 void SetMediaSsrc(uint32_t ssrc);
danilchap7336eeb2016-02-08 03:35:10 -080049 uint32_t media_ssrc() const;
50
51 std::vector<TmmbItem> items_;
danilchapef3d8052016-01-11 03:31:08 -080052};
danilchapef3d8052016-01-11 03:31:08 -080053} // namespace rtcp
54} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020055#endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_