[Stats] Add minimum RTCReceivedRtpStreamStats with jitter and packetsLost
Spec: https://www.w3.org/TR/webrtc-stats/#receivedrtpstats-dict*
According to the spec, |RTCReceivedRtpStreamStats| is the base class for |RTCInboundRtpStreamStats| and |RTCRemoteInboundRtpStreamStats|. This structure isn't visible in JavaScript but it's important to bring it up to spec for the C++ part. This CL adds the barebone |RTCReceivedRtpStreamStats| with a bunch of TODOs for later migrations.
This commit makes the minimum |RTCReceivedRtpStreamStats| and rebase |RTCInboundRtpStreamStats| and |RTCRemoteInboundRtpStreamStats| to use the new class as the parent class.
This commit also moves |jitter| and |packets_lost| to |RTCReceivedRtpStreamStats|, from |RTCInboundRtpStreamStats| and |RTCRemoteInboundRtpStreamStats|. Moving these two first because they are the two that exist in both subclasses for now.
Bug: webrtc:12532
Change-Id: I0ec74fd241f16c1e1a6498b6baa621ca0489f279
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/210340
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33435}
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index a6044ba..68dd17b 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -770,7 +770,6 @@
void VerifyRTCRTPStreamStats(const RTCRTPStreamStats& stream,
RTCStatsVerifier* verifier) {
verifier->TestMemberIsDefined(stream.ssrc);
- verifier->TestMemberIsDefined(stream.is_remote);
verifier->TestMemberIsDefined(stream.media_type);
verifier->TestMemberIsDefined(stream.kind);
verifier->TestMemberIsIDReference(stream.track_id,
@@ -778,16 +777,6 @@
verifier->TestMemberIsIDReference(stream.transport_id,
RTCTransportStats::kType);
verifier->TestMemberIsIDReference(stream.codec_id, RTCCodecStats::kType);
- if (stream.media_type.is_defined() && *stream.media_type == "video") {
- verifier->TestMemberIsNonNegative<uint32_t>(stream.fir_count);
- verifier->TestMemberIsNonNegative<uint32_t>(stream.pli_count);
- verifier->TestMemberIsNonNegative<uint32_t>(stream.nack_count);
- } else {
- verifier->TestMemberIsUndefined(stream.fir_count);
- verifier->TestMemberIsUndefined(stream.pli_count);
- verifier->TestMemberIsUndefined(stream.nack_count);
- }
- verifier->TestMemberIsUndefined(stream.sli_count);
}
bool VerifyRTCInboundRTPStreamStats(
@@ -820,6 +809,7 @@
// this test. See RFC 3550.
verifier.TestMemberIsNonNegative<int32_t>(inbound_stream.packets_lost);
verifier.TestMemberIsDefined(inbound_stream.last_packet_received_timestamp);
+ verifier.TestMemberIsDefined(inbound_stream.is_remote);
if (inbound_stream.frames_received.ValueOrDefault(0) > 0) {
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.frame_width);
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.frame_height);
@@ -852,7 +842,13 @@
verifier.TestMemberIsUndefined(inbound_stream.total_audio_energy);
verifier.TestMemberIsUndefined(inbound_stream.total_samples_duration);
verifier.TestMemberIsNonNegative<int32_t>(inbound_stream.frames_received);
+ verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.fir_count);
+ verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.pli_count);
+ verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.nack_count);
} else {
+ verifier.TestMemberIsUndefined(inbound_stream.fir_count);
+ verifier.TestMemberIsUndefined(inbound_stream.pli_count);
+ verifier.TestMemberIsUndefined(inbound_stream.nack_count);
verifier.TestMemberIsNonNegative<double>(inbound_stream.jitter);
verifier.TestMemberIsNonNegative<double>(
inbound_stream.jitter_buffer_delay);
@@ -925,16 +921,23 @@
*outbound_stream.media_type == "video") {
verifier.TestMemberIsIDReference(outbound_stream.media_source_id,
RTCVideoSourceStats::kType);
+ verifier.TestMemberIsNonNegative<uint32_t>(outbound_stream.fir_count);
+ verifier.TestMemberIsNonNegative<uint32_t>(outbound_stream.pli_count);
+ verifier.TestMemberIsNonNegative<uint32_t>(outbound_stream.nack_count);
if (*outbound_stream.frames_encoded > 0) {
verifier.TestMemberIsNonNegative<uint64_t>(outbound_stream.qp_sum);
} else {
verifier.TestMemberIsUndefined(outbound_stream.qp_sum);
}
} else {
+ verifier.TestMemberIsUndefined(outbound_stream.fir_count);
+ verifier.TestMemberIsUndefined(outbound_stream.pli_count);
+ verifier.TestMemberIsUndefined(outbound_stream.nack_count);
verifier.TestMemberIsIDReference(outbound_stream.media_source_id,
RTCAudioSourceStats::kType);
verifier.TestMemberIsUndefined(outbound_stream.qp_sum);
}
+ verifier.TestMemberIsDefined(outbound_stream.is_remote);
verifier.TestMemberIsOptionalIDReference(
outbound_stream.remote_id, RTCRemoteInboundRtpStreamStats::kType);
verifier.TestMemberIsNonNegative<uint32_t>(outbound_stream.packets_sent);