Index: webrtc/modules/rtp_rtcp/source/report_block_information.h |
diff --git a/webrtc/modules/rtp_rtcp/source/report_block_information.h b/webrtc/modules/rtp_rtcp/source/report_block_information.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3398f66ea5abe73383e82d8015bd8362c67599d3 |
--- /dev/null |
+++ b/webrtc/modules/rtp_rtcp/source/report_block_information.h |
@@ -0,0 +1,65 @@ |
+/* |
+ * 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 |
+ * 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_REPORT_BLOCK_INFORMATION_H_ |
+#define WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ |
+ |
+#include "webrtc/base/basictypes.h" |
+#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
+#include "webrtc/system_wrappers/include/ntp_time.h" |
+ |
+namespace webrtc { |
+namespace RTCPUtility { |
+struct RTCPPacketReportBlockItem; |
+} // namespace RTCPUtility |
+ |
+namespace rtcp { |
+class ReportBlock; |
+ |
+// Keeps last received report block and some additional statistic information. |
+class ReportBlockInformation { |
+ public: |
+ ReportBlockInformation(); |
+ ReportBlockInformation(const ReportBlockInformation&) = default; |
+ ~ReportBlockInformation() {} |
+ |
+ ReportBlockInformation& operator=(const ReportBlockInformation&) = default; |
+ // TODO(danilchap): Remove this version of the |
+ // function when RTCP parsing would switch from RTCPUtility. |
+ void AddBlock(const RTCPUtility::RTCPPacketReportBlockItem& block, |
+ uint32_t remote_ssrc, |
+ NtpTime now); |
+ void AddBlock(const rtcp::ReportBlock& block, |
+ uint32_t remote_ssrc, |
+ NtpTime now); |
+ |
+ const RTCPReportBlock& LastBlock() const; |
+ bool HasRtt() const; |
+ int64_t LastRttMs() const; |
+ int64_t MinRttMs() const; |
+ int64_t MaxRttMs() const; |
+ int64_t AvgRttMs() const; |
+ |
+ private: |
+ // TODO(danilchap): Incorporate this function into AddBlock when only one |
+ // version would be left. |
+ void AddRtt(NtpTime now); |
+ // Number of blocks received where rtt could be calculated. |
+ size_t number_rtt_; |
+ // rtt is stored in 1/2^16 seconds (compact ntp representation). |
+ uint32_t last_rtt_; |
+ uint32_t min_rtt_; |
+ uint32_t max_rtt_; |
+ uint64_t sum_rtt_; |
+ RTCPReportBlock last_received_block_; |
+}; |
+} // namespace rtcp |
+} // namespace webrtc |
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_REPORT_BLOCK_INFORMATION_H_ |