Implement RTCRemoteInboundRtpStreamStats for both audio and video.

This implements the essentials of RTCRemoteInboundRtpStreamStats. This
includes:
- ssrc
- transportId
- codecId
- packetsLost
- jitter
- localId
- roundTripTime
https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*

The following members are not implemented because they require more
work...
- From RTCReceivedRtpStreamStats: packetsReceived, packetsDiscarded,
  packetsRepaired, burstPacketsLost, burstPacketsDiscarded,
  burstLossCount, burstDiscardCount, burstLossRate, burstDiscardRate,
  gapLossRate and gapDiscardRate.
- From RTCRemoteInboundRtpStreamStats: fractionLost.

Bug: webrtc:10455, webrtc:10456
Change-Id: If2ab0da7105d8c93bba58e14aa93bd22ffe57f1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138067
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28073}
This commit is contained in:
Henrik Boström
2019-05-27 13:40:25 +02:00
committed by Commit Bot
parent 6e436d1cc0
commit 883eefc59e
8 changed files with 475 additions and 2 deletions

View File

@ -468,6 +468,46 @@ class RTC_EXPORT RTCOutboundRTPStreamStats final : public RTCRTPStreamStats {
RTCStatsMember<std::string> content_type;
};
// TODO(https://crbug.com/webrtc/10671): Refactor the stats dictionaries to have
// the same hierarchy as in the spec; implement RTCReceivedRtpStreamStats.
// Several metrics are shared between "outbound-rtp", "remote-inbound-rtp",
// "inbound-rtp" and "remote-outbound-rtp". In the spec there is a hierarchy of
// dictionaries that minimizes defining the same metrics in multiple places.
// From JavaScript this hierarchy is not observable and the spec's hierarchy is
// purely editorial. In C++ non-final classes in the hierarchy could be used to
// refer to different stats objects within the hierarchy.
// https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
class RTC_EXPORT RTCRemoteInboundRtpStreamStats final : public RTCStats {
public:
WEBRTC_RTCSTATS_DECL();
RTCRemoteInboundRtpStreamStats(const std::string& id, int64_t timestamp_us);
RTCRemoteInboundRtpStreamStats(std::string&& id, int64_t timestamp_us);
RTCRemoteInboundRtpStreamStats(const RTCRemoteInboundRtpStreamStats& other);
~RTCRemoteInboundRtpStreamStats() override;
// In the spec RTCRemoteInboundRtpStreamStats inherits from RTCRtpStreamStats
// and RTCReceivedRtpStreamStats. The members here are listed based on where
// they are defined in the spec.
// RTCRtpStreamStats
RTCStatsMember<uint32_t> ssrc;
RTCStatsMember<std::string> kind;
RTCStatsMember<std::string> transport_id;
RTCStatsMember<std::string> codec_id;
// RTCReceivedRtpStreamStats
RTCStatsMember<int32_t> packets_lost;
RTCStatsMember<double> jitter;
// TODO(hbos): The following RTCReceivedRtpStreamStats metrics should also be
// implemented: packetsReceived, packetsDiscarded, packetsRepaired,
// burstPacketsLost, burstPacketsDiscarded, burstLossCount, burstDiscardCount,
// burstLossRate, burstDiscardRate, gapLossRate and gapDiscardRate.
// RTCRemoteInboundRtpStreamStats
RTCStatsMember<std::string> local_id;
RTCStatsMember<double> round_trip_time;
// TODO(hbos): The following RTCRemoteInboundRtpStreamStats metric should also
// be implemented: fractionLost.
};
// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
public: