New const method StreamStatistician::GetStats
And a corresponding struct RtpReceiveStats. This is intended
to hold the information exposed via GetStats, which is quite
different from the stats reported to the peer via RTCP.
This is a preparation for moving ReceiveStatistics out of the
individual receive stream objects, and instead have a shared instance
owned by RtpStreamReceiverController or maybe Call.
Bug: webrtc:10679,chromium:677543
Change-Id: Ibb52ee769516ddc51da109b7f2319405693be5d5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/148982
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28943}
diff --git a/modules/rtp_rtcp/source/receive_statistics_impl.cc b/modules/rtp_rtcp/source/receive_statistics_impl.cc
index ab896cb..f4ea2a0 100644
--- a/modules/rtp_rtcp/source/receive_statistics_impl.cc
+++ b/modules/rtp_rtcp/source/receive_statistics_impl.cc
@@ -166,6 +166,19 @@
enable_retransmit_detection_ = enable;
}
+RtpReceiveStats StreamStatisticianImpl::GetStats() const {
+ rtc::CritScope cs(&stream_lock_);
+ RtpReceiveStats stats;
+ stats.packets_lost = cumulative_loss_;
+ // TODO(nisse): Can we return a float instead?
+ // Note: internal jitter value is in Q4 and needs to be scaled by 1/16.
+ stats.jitter = jitter_q4_ >> 4;
+ stats.last_packet_received_timestamp_ms =
+ receive_counters_.last_packet_received_timestamp_ms;
+ stats.packet_counter = receive_counters_.transmitted;
+ return stats;
+}
+
bool StreamStatisticianImpl::GetStatistics(RtcpStatistics* statistics,
bool reset) {
rtc::CritScope cs(&stream_lock_);