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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h

Issue 1670973002: [rtp_rtcp] rtcp::Tmmbn cleaned and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase & 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h
index 82bf9dd9e96f7b154dac8b8e117bb578024b92ce..26a44082d3515c1342c60156b28d60e0e3cd0fe4 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h
@@ -6,34 +6,39 @@
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
- *
*/
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
#include <vector>
+
#include "webrtc/base/basictypes.h"
-#include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
+#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
+#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
namespace webrtc {
namespace rtcp {
-
-// Temporary Maximum Media Stream Bit Rate Notification (TMMBN) (RFC 5104).
-class Tmmbn : public RtcpPacket {
+// Temporary Maximum Media Stream Bit Rate Notification (TMMBN).
+// RFC 5104, Section 4.2.2.
+class Tmmbn : public Rtpfb {
public:
- Tmmbn() : RtcpPacket() {
- memset(&tmmbn_, 0, sizeof(tmmbn_));
- }
+ static const uint8_t kFeedbackMessageType = 4;
+
+ Tmmbn() {}
+ ~Tmmbn() override {}
- virtual ~Tmmbn() {}
+ // Parse assumes header is already parsed and validated.
+ bool Parse(const RTCPUtility::RtcpCommonHeader& header,
+ const uint8_t* payload); // Size of the payload is in the header.
- void From(uint32_t ssrc) {
- tmmbn_.SenderSSRC = ssrc;
+ void WithTmmbr(uint32_t ssrc, uint32_t bitrate_kbps, uint16_t overhead) {
+ WithTmmbr(TmmbItem(ssrc, bitrate_kbps * 1000, overhead));
}
- // Max 50 TMMBR can be added per TMMBN.
- bool WithTmmbr(uint32_t ssrc, uint32_t bitrate_kbps, uint16_t overhead);
+ void WithTmmbr(const TmmbItem& item);
+
+ const std::vector<TmmbItem>& items() const { return items_; }
protected:
bool Create(uint8_t* packet,
@@ -42,19 +47,19 @@ class Tmmbn : public RtcpPacket {
RtcpPacket::PacketReadyCallback* callback) const override;
private:
- static const int kMaxNumberOfTmmbrs = 50;
-
- size_t BlockLength() const {
- const size_t kFciLen = 8;
- return kCommonFbFmtLength + kFciLen * tmmbn_items_.size();
+ size_t BlockLength() const override {
+ return kHeaderLength + kCommonFeedbackLength +
+ TmmbItem::kLength * items_.size();
}
- RTCPUtility::RTCPPacketRTPFBTMMBN tmmbn_;
- std::vector<RTCPUtility::RTCPPacketRTPFBTMMBRItem> tmmbn_items_;
+ // Media ssrc is unused, shadow base class setter and getter.
+ void To(uint32_t ssrc);
+ uint32_t media_ssrc() const;
+
+ std::vector<TmmbItem> items_;
RTC_DISALLOW_COPY_AND_ASSIGN(Tmmbn);
};
-
} // namespace rtcp
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TMMBN_H_
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698