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/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index 3b92419..43f4be9 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -388,6 +388,7 @@
RTCRTPStreamStats(std::string&& id, int64_t timestamp_us);
};
+// https://www.w3.org/TR/webrtc-stats/#receivedrtpstats-dict*
class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRTPStreamStats {
public:
WEBRTC_RTCSTATS_DECL();
@@ -410,6 +411,22 @@
RTCReceivedRtpStreamStats(std::string&& id, int64_t timestamp_us);
};
+// https://www.w3.org/TR/webrtc-stats/#sentrtpstats-dict*
+class RTC_EXPORT RTCSentRtpStreamStats : public RTCRTPStreamStats {
+ public:
+ WEBRTC_RTCSTATS_DECL();
+
+ RTCSentRtpStreamStats(const RTCSentRtpStreamStats& other);
+ ~RTCSentRtpStreamStats() override;
+
+ RTCStatsMember<uint32_t> packets_sent;
+ RTCStatsMember<uint64_t> bytes_sent;
+
+ protected:
+ RTCSentRtpStreamStats(const std::string&& id, int64_t timestamp_us);
+ RTCSentRtpStreamStats(std::string&& id, int64_t timestamp_us);
+};
+
// https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*
// TODO(hbos): Support the remote case |is_remote = true|.
// https://bugs.webrtc.org/7065
@@ -423,6 +440,7 @@
RTCInboundRTPStreamStats(const RTCInboundRTPStreamStats& other);
~RTCInboundRTPStreamStats() override;
+ RTCStatsMember<std::string> remote_id;
RTCStatsMember<uint32_t> packets_received;
RTCStatsMember<uint64_t> fec_packets_received;
RTCStatsMember<uint64_t> fec_packets_discarded;
@@ -573,6 +591,22 @@
RTCStatsMember<int32_t> round_trip_time_measurements;
};
+// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
+class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
+ : public RTCSentRtpStreamStats {
+ public:
+ WEBRTC_RTCSTATS_DECL();
+
+ RTCRemoteOutboundRtpStreamStats(const std::string& id, int64_t timestamp_us);
+ RTCRemoteOutboundRtpStreamStats(std::string&& id, int64_t timestamp_us);
+ RTCRemoteOutboundRtpStreamStats(const RTCRemoteOutboundRtpStreamStats& other);
+ ~RTCRemoteOutboundRtpStreamStats() override;
+
+ RTCStatsMember<std::string> local_id;
+ RTCStatsMember<double> remote_timestamp;
+ RTCStatsMember<uint64_t> reports_sent;
+};
+
// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
public: