danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 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. |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 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> |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 15 | |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 16 | #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" |
| 17 | #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 18 | #include "webrtc/rtc_base/basictypes.h" |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | namespace rtcp { |
danilchap | 6ce1adc | 2016-05-26 05:29:14 -0700 | [diff] [blame] | 22 | class CommonHeader; |
| 23 | |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 24 | // Temporary Maximum Media Stream Bit Rate Notification (TMMBN). |
| 25 | // RFC 5104, Section 4.2.2. |
| 26 | class Tmmbn : public Rtpfb { |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 27 | public: |
danilchap | 6ce1adc | 2016-05-26 05:29:14 -0700 | [diff] [blame] | 28 | static constexpr uint8_t kFeedbackMessageType = 4; |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 29 | |
eladalon | 8fa21c4 | 2017-06-16 07:07:47 -0700 | [diff] [blame] | 30 | Tmmbn(); |
| 31 | ~Tmmbn() override; |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 32 | |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 33 | // Parse assumes header is already parsed and validated. |
danilchap | 6ce1adc | 2016-05-26 05:29:14 -0700 | [diff] [blame] | 34 | bool Parse(const CommonHeader& packet); |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 35 | |
danilchap | 822a16f | 2016-09-27 09:27:47 -0700 | [diff] [blame] | 36 | void AddTmmbr(const TmmbItem& item); |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 37 | |
| 38 | const std::vector<TmmbItem>& items() const { return items_; } |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 39 | |
eladalon | 8fa21c4 | 2017-06-16 07:07:47 -0700 | [diff] [blame] | 40 | size_t BlockLength() const override; |
| 41 | |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 42 | bool Create(uint8_t* packet, |
| 43 | size_t* index, |
| 44 | size_t max_length, |
| 45 | RtcpPacket::PacketReadyCallback* callback) const override; |
| 46 | |
| 47 | private: |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 48 | // Media ssrc is unused, shadow base class setter and getter. |
danilchap | 822a16f | 2016-09-27 09:27:47 -0700 | [diff] [blame] | 49 | void SetMediaSsrc(uint32_t ssrc); |
danilchap | 7336eeb | 2016-02-08 03:35:10 -0800 | [diff] [blame] | 50 | uint32_t media_ssrc() const; |
| 51 | |
| 52 | std::vector<TmmbItem> items_; |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 53 | }; |
danilchap | ef3d805 | 2016-01-11 03:31:08 -0800 | [diff] [blame] | 54 | } // namespace rtcp |
| 55 | } // namespace webrtc |
| 56 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_ |