1 /* 2 * Copyright 2019 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. 9 */ 10 11 #ifndef MODULES_RTP_RTCP_INCLUDE_REPORT_BLOCK_DATA_H_ 12 #define MODULES_RTP_RTCP_INCLUDE_REPORT_BLOCK_DATA_H_ 13 14 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" 15 16 namespace webrtc { 17 18 class ReportBlockData { 19 public: 20 ReportBlockData(); 21 report_block()22 const RTCPReportBlock& report_block() const { return report_block_; } report_block_timestamp_utc_us()23 int64_t report_block_timestamp_utc_us() const { 24 return report_block_timestamp_utc_us_; 25 } last_rtt_ms()26 int64_t last_rtt_ms() const { return last_rtt_ms_; } min_rtt_ms()27 int64_t min_rtt_ms() const { return min_rtt_ms_; } max_rtt_ms()28 int64_t max_rtt_ms() const { return max_rtt_ms_; } sum_rtt_ms()29 int64_t sum_rtt_ms() const { return sum_rtt_ms_; } num_rtts()30 size_t num_rtts() const { return num_rtts_; } has_rtt()31 bool has_rtt() const { return num_rtts_ != 0; } 32 33 double AvgRttMs() const; 34 35 void SetReportBlock(RTCPReportBlock report_block, 36 int64_t report_block_timestamp_utc_us); 37 void AddRoundTripTimeSample(int64_t rtt_ms); 38 39 private: 40 RTCPReportBlock report_block_; 41 int64_t report_block_timestamp_utc_us_; 42 43 int64_t last_rtt_ms_; 44 int64_t min_rtt_ms_; 45 int64_t max_rtt_ms_; 46 int64_t sum_rtt_ms_; 47 size_t num_rtts_; 48 }; 49 50 class ReportBlockDataObserver { 51 public: 52 virtual ~ReportBlockDataObserver() = default; 53 54 virtual void OnReportBlockDataUpdated(ReportBlockData report_block_data) = 0; 55 }; 56 57 } // namespace webrtc 58 59 #endif // MODULES_RTP_RTCP_INCLUDE_REPORT_BLOCK_DATA_H_ 60