Add `RTCRemoteOutboundRtpStreamStats` for audio streams
Changes:
- adding the `RTCRemoteOutboundRtpStreamStats` dictionary (see [1])
- collection of remote outbound stats (only for audio streams)
- adding `remote_id` to the inbound stats and set with the ID of the
corresponding remote outbound stats only if the latter are available
- unit tests
[1] https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteoutboundrtpstreamstats
Tested: verified from chrome://webrtc-internals during an appr.tc call
Bug: webrtc:12529
Change-Id: Ide91dc04a3c387ba439618a9c6b64a95994a1940
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211042
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33545}
diff --git a/stats/rtcstats_objects.cc b/stats/rtcstats_objects.cc
index 3a12eea..656cb4a 100644
--- a/stats/rtcstats_objects.cc
+++ b/stats/rtcstats_objects.cc
@@ -608,7 +608,32 @@
// clang-format off
WEBRTC_RTCSTATS_IMPL(
+ RTCSentRtpStreamStats, RTCRTPStreamStats, "sent-rtp",
+ &packets_sent,
+ &bytes_sent)
+// clang-format on
+
+RTCSentRtpStreamStats::RTCSentRtpStreamStats(const std::string&& id,
+ int64_t timestamp_us)
+ : RTCSentRtpStreamStats(std::string(id), timestamp_us) {}
+
+RTCSentRtpStreamStats::RTCSentRtpStreamStats(std::string&& id,
+ int64_t timestamp_us)
+ : RTCRTPStreamStats(std::move(id), timestamp_us),
+ packets_sent("packetsSent"),
+ bytes_sent("bytesSent") {}
+
+RTCSentRtpStreamStats::RTCSentRtpStreamStats(const RTCSentRtpStreamStats& other)
+ : RTCRTPStreamStats(other),
+ packets_sent(other.packets_sent),
+ bytes_sent(other.bytes_sent) {}
+
+RTCSentRtpStreamStats::~RTCSentRtpStreamStats() {}
+
+// clang-format off
+WEBRTC_RTCSTATS_IMPL(
RTCInboundRTPStreamStats, RTCReceivedRtpStreamStats, "inbound-rtp",
+ &remote_id,
&packets_received,
&fec_packets_received,
&fec_packets_discarded,
@@ -665,6 +690,7 @@
RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
int64_t timestamp_us)
: RTCReceivedRtpStreamStats(std::move(id), timestamp_us),
+ remote_id("remoteId"),
packets_received("packetsReceived"),
fec_packets_received("fecPacketsReceived"),
fec_packets_discarded("fecPacketsDiscarded"),
@@ -716,6 +742,7 @@
RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
const RTCInboundRTPStreamStats& other)
: RTCReceivedRtpStreamStats(other),
+ remote_id(other.remote_id),
packets_received(other.packets_received),
fec_packets_received(other.fec_packets_received),
fec_packets_discarded(other.fec_packets_discarded),
@@ -914,6 +941,37 @@
RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
// clang-format off
+WEBRTC_RTCSTATS_IMPL(
+ RTCRemoteOutboundRtpStreamStats, RTCSentRtpStreamStats,
+ "remote-outbound-rtp",
+ &local_id,
+ &remote_timestamp,
+ &reports_sent)
+// clang-format on
+
+RTCRemoteOutboundRtpStreamStats::RTCRemoteOutboundRtpStreamStats(
+ const std::string& id,
+ int64_t timestamp_us)
+ : RTCRemoteOutboundRtpStreamStats(std::string(id), timestamp_us) {}
+
+RTCRemoteOutboundRtpStreamStats::RTCRemoteOutboundRtpStreamStats(
+ std::string&& id,
+ int64_t timestamp_us)
+ : RTCSentRtpStreamStats(std::move(id), timestamp_us),
+ local_id("localId"),
+ remote_timestamp("remoteTimestamp"),
+ reports_sent("reportsSent") {}
+
+RTCRemoteOutboundRtpStreamStats::RTCRemoteOutboundRtpStreamStats(
+ const RTCRemoteOutboundRtpStreamStats& other)
+ : RTCSentRtpStreamStats(other),
+ local_id(other.local_id),
+ remote_timestamp(other.remote_timestamp),
+ reports_sent(other.reports_sent) {}
+
+RTCRemoteOutboundRtpStreamStats::~RTCRemoteOutboundRtpStreamStats() {}
+
+// clang-format off
WEBRTC_RTCSTATS_IMPL(RTCMediaSourceStats, RTCStats, "parent-media-source",
&track_identifier,
&kind)