mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-19 16:47:50 +01:00

The ReportBlockData contains information about a ReportBlock and additional data such as RTT. This will be used for the calculation of RTCRemoteInboundRtpStreamStats, see full picture here: https://webrtc-review.googlesource.com/c/src/+/134107 ReportBlockData is a class version of the previously internal struct RTCPReceiver::ReportBlockWithRtt. - The new name makes sense even if we add more info to it, which will be needed for future metrics. - The new location is modules/rtp_rtcp/include/report_block_data.h. The RTCPReceiver allows obtaining the ReportBlockData in two ways: 1. Using a ReportBlockDataObserver that is notified on receiving a report block. 2. Using the GetLatestReportBlockData(). Both codepaths will be needed; video stats uses observers and audio stats uses polling. Further plumbing will be done in follow-up CLs. Bug: webrtc:10455, webrtc:10456 Change-Id: Ic9e5b4f451b5f4b203efcd6fa3bbf9736487e1f4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136584 Commit-Queue: Henrik Boström <hbos@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27961}
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
/*
|
|
* Copyright 2019 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 MODULES_RTP_RTCP_INCLUDE_REPORT_BLOCK_DATA_H_
|
|
#define MODULES_RTP_RTCP_INCLUDE_REPORT_BLOCK_DATA_H_
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
|
|
|
namespace webrtc {
|
|
|
|
class ReportBlockData {
|
|
public:
|
|
ReportBlockData();
|
|
|
|
const RTCPReportBlock& report_block() const { return report_block_; }
|
|
int64_t report_block_timestamp_utc_us() const {
|
|
return report_block_timestamp_utc_us_;
|
|
}
|
|
int64_t last_rtt_ms() const { return last_rtt_ms_; }
|
|
int64_t min_rtt_ms() const { return min_rtt_ms_; }
|
|
int64_t max_rtt_ms() const { return max_rtt_ms_; }
|
|
int64_t sum_rtt_ms() const { return sum_rtt_ms_; }
|
|
size_t num_rtts() const { return num_rtts_; }
|
|
bool has_rtt() const { return num_rtts_ != 0; }
|
|
|
|
double AvgRttMs() const;
|
|
|
|
void SetReportBlock(RTCPReportBlock report_block,
|
|
int64_t report_block_timestamp_utc_us);
|
|
void AddRoundTripTimeSample(int64_t rtt_ms);
|
|
|
|
private:
|
|
RTCPReportBlock report_block_;
|
|
int64_t report_block_timestamp_utc_us_;
|
|
|
|
int64_t last_rtt_ms_;
|
|
int64_t min_rtt_ms_;
|
|
int64_t max_rtt_ms_;
|
|
int64_t sum_rtt_ms_;
|
|
size_t num_rtts_;
|
|
};
|
|
|
|
class ReportBlockDataObserver {
|
|
public:
|
|
virtual ~ReportBlockDataObserver() = default;
|
|
|
|
virtual void OnReportBlockDataUpdated(ReportBlockData report_block_data) = 0;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_RTP_RTCP_INCLUDE_REPORT_BLOCK_DATA_H_
|