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

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

Issue 1544983002: [rtp_rtcp] rtcp::SenderReport moved into own file and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 11 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
Index: webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h
similarity index 50%
copy from webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h
copy to webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h
index 172a84ea2facbdf3a71c838c2f17f10a21a5cf2a..e26911abc3af24fa5cd00e2b4759fb0eabd98e74 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@@ -8,34 +8,50 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RECEIVER_REPORT_H_
-#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RECEIVER_REPORT_H_
+#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SENDER_REPORT_H_
+#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SENDER_REPORT_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/report_block.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
+#include "webrtc/system_wrappers/include/ntp_time.h"
namespace webrtc {
namespace rtcp {
-class ReceiverReport : public RtcpPacket {
+class SenderReport : public RtcpPacket {
public:
- static const uint8_t kPacketType = 201;
- ReceiverReport() : sender_ssrc_(0) {}
+ static const uint8_t kPacketType = 200;
- virtual ~ReceiverReport() {}
+ SenderReport();
+ virtual ~SenderReport() {}
// 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) { sender_ssrc_ = ssrc; }
+ void WithNtp(NtpTime ntp) { ntp_ = ntp; }
+ void WithRtpTimestamp(uint32_t rtp_timestamp) {
+ rtp_timestamp_ = rtp_timestamp;
+ }
+ void WithPacketCount(uint32_t packet_count) {
+ sender_packet_count_ = packet_count;
+ }
+ void WithOctetCount(uint32_t octet_count) {
+ sender_octet_count_ = octet_count;
+ }
bool WithReportBlock(const ReportBlock& block);
+ void ClearReportBlocks() { report_blocks_.clear(); }
uint32_t sender_ssrc() const { return sender_ssrc_; }
+ NtpTime ntp() const { return ntp_; }
+ uint32_t rtp_timestamp() const { return rtp_timestamp_; }
+ uint32_t sender_packet_count() const { return sender_packet_count_; }
+ uint32_t sender_octet_count() const { return sender_octet_count_; }
+
const std::vector<ReportBlock>& report_blocks() const {
return report_blocks_;
}
@@ -47,20 +63,24 @@ class ReceiverReport : public RtcpPacket {
RtcpPacket::PacketReadyCallback* callback) const override;
private:
- static const size_t kRrBaseLength = 4;
- static const size_t kMaxNumberOfReportBlocks = 0x1F;
+ static const size_t kMaxNumberOfReportBlocks = 0x1f;
+ const size_t kSenderBaseLength = 24;
- size_t BlockLength() const {
- return kHeaderLength + kRrBaseLength +
+ size_t BlockLength() const override {
+ return kHeaderLength + kSenderBaseLength +
report_blocks_.size() * ReportBlock::kLength;
}
uint32_t sender_ssrc_;
+ NtpTime ntp_;
+ uint32_t rtp_timestamp_;
+ uint32_t sender_packet_count_;
+ uint32_t sender_octet_count_;
std::vector<ReportBlock> report_blocks_;
- RTC_DISALLOW_COPY_AND_ASSIGN(ReceiverReport);
+ RTC_DISALLOW_COPY_AND_ASSIGN(SenderReport);
};
} // namespace rtcp
} // namespace webrtc
-#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RECEIVER_REPORT_H_
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SENDER_REPORT_H_

Powered by Google App Engine
This is Rietveld 408576698