Populate “fractionLost” stats for remote inbound rtp streams
Tests: ./out/Default/peerconnection_unittests Manually tested with Chromium to see the data populated Spec: https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict* Bug: webrtc:12506 Change-Id: I60ef8061fb31deab06ca5f115246ceb5a8cdc5ec Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208960 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33361}
This commit is contained in:
@ -555,8 +555,7 @@ class RTC_EXPORT RTCRemoteInboundRtpStreamStats final : public RTCStats {
|
||||
// RTCRemoteInboundRtpStreamStats
|
||||
RTCStatsMember<std::string> local_id;
|
||||
RTCStatsMember<double> round_trip_time;
|
||||
// TODO(hbos): The following RTCRemoteInboundRtpStreamStats metric should also
|
||||
// be implemented: fractionLost.
|
||||
RTCStatsMember<double> fraction_lost;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
|
||||
|
@ -541,6 +541,8 @@ ProduceRemoteInboundRtpStreamStatsFromReportBlockData(
|
||||
remote_inbound->kind =
|
||||
media_type == cricket::MEDIA_TYPE_AUDIO ? "audio" : "video";
|
||||
remote_inbound->packets_lost = report_block.packets_lost;
|
||||
remote_inbound->fraction_lost =
|
||||
static_cast<double>(report_block.fraction_lost) / (1 << 8);
|
||||
remote_inbound->round_trip_time =
|
||||
static_cast<double>(report_block_data.last_rtt_ms()) /
|
||||
rtc::kNumMillisecsPerSec;
|
||||
|
@ -2678,6 +2678,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
|
||||
const int64_t kReportBlockTimestampUtcUs = 123456789;
|
||||
const int64_t kRoundTripTimeMs = 13000;
|
||||
const double kRoundTripTimeSeconds = 13.0;
|
||||
const uint8_t kFractionLost = 12;
|
||||
|
||||
// The report block's timestamp cannot be from the future, set the fake clock
|
||||
// to match.
|
||||
@ -2690,6 +2691,7 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
|
||||
// |source_ssrc|, "SSRC of the RTP packet sender".
|
||||
report_block.source_ssrc = ssrc;
|
||||
report_block.packets_lost = 7;
|
||||
report_block.fraction_lost = kFractionLost;
|
||||
ReportBlockData report_block_data;
|
||||
report_block_data.SetReportBlock(report_block, kReportBlockTimestampUtcUs);
|
||||
report_block_data.AddRoundTripTimeSample(1234);
|
||||
@ -2708,6 +2710,8 @@ TEST_P(RTCStatsCollectorTestWithParamKind,
|
||||
"RTCRemoteInboundRtp" + MediaTypeUpperCase() + stream_id,
|
||||
kReportBlockTimestampUtcUs);
|
||||
expected_remote_inbound_rtp.ssrc = ssrc;
|
||||
expected_remote_inbound_rtp.fraction_lost =
|
||||
static_cast<double>(kFractionLost) / (1 << 8);
|
||||
expected_remote_inbound_rtp.kind = MediaTypeLowerCase();
|
||||
expected_remote_inbound_rtp.transport_id =
|
||||
"RTCTransport_TransportName_1"; // 1 for RTP (we have no RTCP
|
||||
|
@ -1014,6 +1014,7 @@ class RTCStatsReportVerifier {
|
||||
verifier.TestMemberIsIDReference(remote_inbound_stream.codec_id,
|
||||
RTCCodecStats::kType);
|
||||
verifier.TestMemberIsDefined(remote_inbound_stream.packets_lost);
|
||||
verifier.TestMemberIsDefined(remote_inbound_stream.fraction_lost);
|
||||
// Note that the existance of RTCCodecStats is needed for |codec_id| and
|
||||
// |jitter| to be present.
|
||||
verifier.TestMemberIsNonNegative<double>(remote_inbound_stream.jitter);
|
||||
|
@ -848,7 +848,8 @@ WEBRTC_RTCSTATS_IMPL(
|
||||
&packets_lost,
|
||||
&jitter,
|
||||
&local_id,
|
||||
&round_trip_time)
|
||||
&round_trip_time,
|
||||
&fraction_lost)
|
||||
// clang-format on
|
||||
|
||||
RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
|
||||
@ -867,7 +868,8 @@ RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
|
||||
packets_lost("packetsLost"),
|
||||
jitter("jitter"),
|
||||
local_id("localId"),
|
||||
round_trip_time("roundTripTime") {}
|
||||
round_trip_time("roundTripTime"),
|
||||
fraction_lost("fractionLost") {}
|
||||
|
||||
RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
|
||||
const RTCRemoteInboundRtpStreamStats& other)
|
||||
@ -879,7 +881,8 @@ RTCRemoteInboundRtpStreamStats::RTCRemoteInboundRtpStreamStats(
|
||||
packets_lost(other.packets_lost),
|
||||
jitter(other.jitter),
|
||||
local_id(other.local_id),
|
||||
round_trip_time(other.round_trip_time) {}
|
||||
round_trip_time(other.round_trip_time),
|
||||
fraction_lost(other.fraction_lost) {}
|
||||
|
||||
RTCRemoteInboundRtpStreamStats::~RTCRemoteInboundRtpStreamStats() {}
|
||||
|
||||
|
Reference in New Issue
Block a user