Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1922)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h

Issue 1675583002: [rtp_rtcp] rtcp::Tmmbr cleaned and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: spelling Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 *
10 */ 9 */
11 10
12 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_
13 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_
14 13
14 #include <vector>
15
15 #include "webrtc/base/basictypes.h" 16 #include "webrtc/base/basictypes.h"
16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
17 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
18 20
19 namespace webrtc { 21 namespace webrtc {
20 namespace rtcp { 22 namespace rtcp {
21 // Temporary Maximum Media Stream Bit Rate Request (TMMBR) (RFC 5104). 23 // Temporary Maximum Media Stream Bit Rate Request (TMMBR).
22 class Tmmbr : public RtcpPacket { 24 // RFC 5104, Section 4.2.1.
25 class Tmmbr : public Rtpfb {
23 public: 26 public:
24 Tmmbr() : RtcpPacket() { 27 static const uint8_t kFeedbackMessageType = 3;
25 memset(&tmmbr_, 0, sizeof(tmmbr_));
26 memset(&tmmbr_item_, 0, sizeof(tmmbr_item_));
27 }
28 28
29 virtual ~Tmmbr() {} 29 Tmmbr() {}
30 ~Tmmbr() override {}
30 31
31 void From(uint32_t ssrc) { 32 // Parse assumes header is already parsed and validated.
32 tmmbr_.SenderSSRC = ssrc; 33 bool Parse(const RTCPUtility::RtcpCommonHeader& header,
33 } 34 const uint8_t* payload); // Size of the payload is in the header.
34 void To(uint32_t ssrc) { 35
35 tmmbr_item_.SSRC = ssrc; 36 void WithTmmbr(const TmmbItem& item);
36 } 37
37 void WithBitrateKbps(uint32_t bitrate_kbps) { 38 const std::vector<TmmbItem>& requests() const { return items_; }
38 tmmbr_item_.MaxTotalMediaBitRate = bitrate_kbps;
39 }
40 void WithOverhead(uint16_t overhead) {
41 assert(overhead <= 0x1ff);
42 tmmbr_item_.MeasuredOverhead = overhead;
43 }
44 39
45 protected: 40 protected:
46 bool Create(uint8_t* packet, 41 bool Create(uint8_t* packet,
47 size_t* index, 42 size_t* index,
48 size_t max_length, 43 size_t max_length,
49 RtcpPacket::PacketReadyCallback* callback) const override; 44 RtcpPacket::PacketReadyCallback* callback) const override;
50 45
51 private: 46 private:
52 size_t BlockLength() const { 47 size_t BlockLength() const override {
53 const size_t kFciLen = 8; 48 return kHeaderLength + kCommonFeedbackLength +
54 return kCommonFbFmtLength + kFciLen; 49 TmmbItem::kLength * items_.size();
55 } 50 }
56 51
57 RTCPUtility::RTCPPacketRTPFBTMMBR tmmbr_; 52 // Media ssrc is unused, shadow base class setter and getter.
58 RTCPUtility::RTCPPacketRTPFBTMMBRItem tmmbr_item_; 53 void To(uint32_t ssrc);
54 uint32_t media_ssrc() const;
55
56 std::vector<TmmbItem> items_;
59 57
60 RTC_DISALLOW_COPY_AND_ASSIGN(Tmmbr); 58 RTC_DISALLOW_COPY_AND_ASSIGN(Tmmbr);
61 }; 59 };
62 } // namespace rtcp 60 } // namespace rtcp
63 } // namespace webrtc 61 } // namespace webrtc
64 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_ 62 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBR_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698