Source code

Revision control

Copy as Markdown

Other Tools

From: "Byron Campen [:bwc]" <docfaraday@gmail.com>
Date: Fri, 12 Mar 2021 08:55:00 -0600
Subject: Bug 1654112 - libwebrtc modification: Surface video RTCP SR stats
again. r=ng
libwebrtc has stopped surfacing these, and Chromium does not support
these stats at all.
---
video/rtp_video_stream_receiver2.cc | 10 ++++++++++
video/rtp_video_stream_receiver2.h | 6 ++++++
video/video_receive_stream2.cc | 8 ++++++++
3 files changed, 24 insertions(+)
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 931c29d8c8..a3e3239225 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1040,6 +1040,16 @@ std::optional<int64_t> RtpVideoStreamReceiver2::LastReceivedKeyframePacketMs()
return std::nullopt;
}
+// Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+// stats at all, and even on the most recent libwebrtc code there does not
+// seem to be any support for these stats right now. So, we hack this in.
+void RtpVideoStreamReceiver2::RemoteRTCPSenderInfo(
+ uint32_t* packet_count, uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const {
+ RTC_DCHECK_RUN_ON(&worker_task_checker_);
+ rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms);
+}
+
std::optional<RtpRtcpInterface::SenderReportStats>
RtpVideoStreamReceiver2::GetSenderReportStats() const {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 141f15c3df..0fb3cd1b7c 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -211,6 +211,12 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
std::optional<RtpRtcpInterface::SenderReportStats> GetSenderReportStats()
const;
+ // Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+ // stats at all, and even on the most recent libwebrtc code there does not
+ // seem to be any support for these stats right now. So, we hack this in.
+ void RemoteRTCPSenderInfo(uint32_t* packet_count, uint32_t* octet_count,
+ int64_t* ntp_timestamp_ms) const;
+
private:
// Implements RtpVideoFrameReceiver.
void ManageFrame(std::unique_ptr<RtpFrameObject> frame) override;
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index 4372fdabdd..a655a072c4 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -578,6 +578,14 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const {
stats.sender_reports_bytes_sent = rtcp_sr_stats->bytes_sent;
stats.sender_reports_reports_count = rtcp_sr_stats->reports_count;
}
+
+ // Mozilla modification: VideoReceiveStream2 and friends do not surface RTCP
+ // stats at all, and even on the most recent libwebrtc code there does not
+ // seem to be any support for these stats right now. So, we hack this in.
+ rtp_video_stream_receiver_.RemoteRTCPSenderInfo(
+ &stats.rtcp_sender_packets_sent, &stats.rtcp_sender_octets_sent,
+ &stats.rtcp_sender_ntp_timestamp_ms);
+
return stats;
}