Complete migration from "track" to "inbound-rtp" stats

Bug: webrtc:11683
Change-Id: I4c4a4fa0a7d6a20976922aca41d57540aa27fd1d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178611
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Eldar Rello <elrello@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#31683}
This commit is contained in:
Eldar Rello
2020-07-06 14:18:07 +03:00
committed by Commit Bot
parent 18523c34b4
commit 94fe0d3de5
5 changed files with 185 additions and 3 deletions

View File

@ -419,6 +419,18 @@ class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
// TODO(hbos): Collect and populate this value for both "audio" and "video",
// currently not collected for "video". https://bugs.webrtc.org/7065
RTCStatsMember<double> jitter;
RTCStatsMember<double> jitter_buffer_delay;
RTCStatsMember<uint64_t> jitter_buffer_emitted_count;
RTCStatsMember<uint64_t> total_samples_received;
RTCStatsMember<uint64_t> concealed_samples;
RTCStatsMember<uint64_t> silent_concealed_samples;
RTCStatsMember<uint64_t> concealment_events;
RTCStatsMember<uint64_t> inserted_samples_for_deceleration;
RTCStatsMember<uint64_t> removed_samples_for_acceleration;
RTCStatsMember<double> audio_level;
RTCStatsMember<double> total_audio_energy;
RTCStatsMember<double> total_samples_duration;
RTCStatsMember<int32_t> frames_received;
// TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
RTCStatsMember<double> round_trip_time;
// TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
@ -441,8 +453,13 @@ class RTC_EXPORT RTCInboundRTPStreamStats final : public RTCRTPStreamStats {
RTCStatsMember<double> gap_loss_rate;
// TODO(hbos): Collect and populate this value. https://bugs.webrtc.org/7065
RTCStatsMember<double> gap_discard_rate;
RTCStatsMember<uint32_t> frame_width;
RTCStatsMember<uint32_t> frame_height;
RTCStatsMember<uint32_t> frame_bit_depth;
RTCStatsMember<double> frames_per_second;
RTCStatsMember<uint32_t> frames_decoded;
RTCStatsMember<uint32_t> key_frames_decoded;
RTCStatsMember<uint32_t> frames_dropped;
RTCStatsMember<double> total_decode_time;
RTCStatsMember<double> total_inter_frame_delay;
RTCStatsMember<double> total_squared_inter_frame_delay;

View File

@ -291,6 +291,24 @@ void SetInboundRTPStreamStatsFromVoiceReceiverInfo(
}
inbound_audio->jitter = static_cast<double>(voice_receiver_info.jitter_ms) /
rtc::kNumMillisecsPerSec;
inbound_audio->jitter_buffer_delay =
voice_receiver_info.jitter_buffer_delay_seconds;
inbound_audio->jitter_buffer_emitted_count =
voice_receiver_info.jitter_buffer_emitted_count;
inbound_audio->total_samples_received =
voice_receiver_info.total_samples_received;
inbound_audio->concealed_samples = voice_receiver_info.concealed_samples;
inbound_audio->silent_concealed_samples =
voice_receiver_info.silent_concealed_samples;
inbound_audio->concealment_events = voice_receiver_info.concealment_events;
inbound_audio->inserted_samples_for_deceleration =
voice_receiver_info.inserted_samples_for_deceleration;
inbound_audio->removed_samples_for_acceleration =
voice_receiver_info.removed_samples_for_acceleration;
inbound_audio->audio_level = voice_receiver_info.audio_level;
inbound_audio->total_audio_energy = voice_receiver_info.total_output_energy;
inbound_audio->total_samples_duration =
voice_receiver_info.total_output_duration;
// |fir_count|, |pli_count| and |sli_count| are only valid for video and are
// purposefully left undefined for audio.
if (voice_receiver_info.last_packet_received_timestamp_ms) {
@ -327,8 +345,21 @@ void SetInboundRTPStreamStatsFromVideoReceiverInfo(
static_cast<uint32_t>(video_receiver_info.plis_sent);
inbound_video->nack_count =
static_cast<uint32_t>(video_receiver_info.nacks_sent);
inbound_video->frames_received = video_receiver_info.frames_received;
inbound_video->frames_decoded = video_receiver_info.frames_decoded;
inbound_video->frames_dropped = video_receiver_info.frames_dropped;
inbound_video->key_frames_decoded = video_receiver_info.key_frames_decoded;
if (video_receiver_info.frame_width > 0) {
inbound_video->frame_width =
static_cast<uint32_t>(video_receiver_info.frame_width);
}
if (video_receiver_info.frame_height > 0) {
inbound_video->frame_height =
static_cast<uint32_t>(video_receiver_info.frame_height);
}
if (video_receiver_info.framerate_rcvd > 0) {
inbound_video->frames_per_second = video_receiver_info.framerate_rcvd;
}
if (video_receiver_info.qp_sum)
inbound_video->qp_sum = *video_receiver_info.qp_sum;
inbound_video->total_decode_time =

View File

@ -1780,6 +1780,18 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
voice_media_info.receivers[0].header_and_padding_bytes_rcvd = 4;
voice_media_info.receivers[0].codec_payload_type = 42;
voice_media_info.receivers[0].jitter_ms = 4500;
voice_media_info.receivers[0].jitter_buffer_delay_seconds = 1.0;
voice_media_info.receivers[0].jitter_buffer_emitted_count = 2;
voice_media_info.receivers[0].total_samples_received = 3;
voice_media_info.receivers[0].concealed_samples = 4;
voice_media_info.receivers[0].silent_concealed_samples = 5;
voice_media_info.receivers[0].concealment_events = 6;
voice_media_info.receivers[0].inserted_samples_for_deceleration = 7;
voice_media_info.receivers[0].removed_samples_for_acceleration = 8;
voice_media_info.receivers[0].audio_level = 9.0;
voice_media_info.receivers[0].total_output_energy = 10.0;
voice_media_info.receivers[0].total_output_duration = 11.0;
voice_media_info.receivers[0].last_packet_received_timestamp_ms =
absl::nullopt;
@ -1818,6 +1830,18 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
expected_audio.packets_lost = -1;
// |expected_audio.last_packet_received_timestamp| should be undefined.
expected_audio.jitter = 4.5;
expected_audio.jitter_buffer_delay = 1.0;
expected_audio.jitter_buffer_emitted_count = 2;
expected_audio.total_samples_received = 3;
expected_audio.concealed_samples = 4;
expected_audio.silent_concealed_samples = 5;
expected_audio.concealment_events = 6;
expected_audio.inserted_samples_for_deceleration = 7;
expected_audio.removed_samples_for_acceleration = 8;
expected_audio.audio_level = 9.0;
expected_audio.total_audio_energy = 10.0;
expected_audio.total_samples_duration = 11.0;
ASSERT_TRUE(report->Get(expected_audio.id()));
EXPECT_EQ(
report->Get(expected_audio.id())->cast_to<RTCInboundRTPStreamStats>(),
@ -1856,8 +1880,10 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
video_media_info.receivers[0].firs_sent = 5;
video_media_info.receivers[0].plis_sent = 6;
video_media_info.receivers[0].nacks_sent = 7;
video_media_info.receivers[0].frames_decoded = 8;
video_media_info.receivers[0].frames_received = 8;
video_media_info.receivers[0].frames_decoded = 9;
video_media_info.receivers[0].key_frames_decoded = 3;
video_media_info.receivers[0].frames_dropped = 13;
video_media_info.receivers[0].qp_sum = absl::nullopt;
video_media_info.receivers[0].total_decode_time_ms = 9000;
video_media_info.receivers[0].total_inter_frame_delay = 0.123;
@ -1901,8 +1927,10 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
expected_video.bytes_received = 3;
expected_video.header_bytes_received = 12;
expected_video.packets_lost = 42;
expected_video.frames_decoded = 8;
expected_video.frames_received = 8;
expected_video.frames_decoded = 9;
expected_video.key_frames_decoded = 3;
expected_video.frames_dropped = 13;
// |expected_video.qp_sum| should be undefined.
expected_video.total_decode_time = 9.0;
expected_video.total_inter_frame_delay = 0.123;

View File

@ -818,13 +818,62 @@ class RTCStatsReportVerifier {
// this test. See RFC 3550.
verifier.TestMemberIsNonNegative<int32_t>(inbound_stream.packets_lost);
verifier.TestMemberIsDefined(inbound_stream.last_packet_received_timestamp);
if (inbound_stream.frames_received.ValueOrDefault(0) > 0) {
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.frame_width);
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.frame_height);
} else {
verifier.TestMemberIsUndefined(inbound_stream.frame_width);
verifier.TestMemberIsUndefined(inbound_stream.frame_height);
}
if (inbound_stream.frames_per_second.is_defined()) {
verifier.TestMemberIsNonNegative<double>(
inbound_stream.frames_per_second);
} else {
verifier.TestMemberIsUndefined(inbound_stream.frames_per_second);
}
verifier.TestMemberIsUndefined(inbound_stream.frame_bit_depth);
if (inbound_stream.media_type.is_defined() &&
*inbound_stream.media_type == "video") {
verifier.TestMemberIsUndefined(inbound_stream.jitter);
verifier.TestMemberIsUndefined(inbound_stream.jitter_buffer_delay);
verifier.TestMemberIsUndefined(
inbound_stream.jitter_buffer_emitted_count);
verifier.TestMemberIsUndefined(inbound_stream.total_samples_received);
verifier.TestMemberIsUndefined(inbound_stream.concealed_samples);
verifier.TestMemberIsUndefined(inbound_stream.silent_concealed_samples);
verifier.TestMemberIsUndefined(inbound_stream.concealment_events);
verifier.TestMemberIsUndefined(
inbound_stream.inserted_samples_for_deceleration);
verifier.TestMemberIsUndefined(
inbound_stream.removed_samples_for_acceleration);
verifier.TestMemberIsUndefined(inbound_stream.audio_level);
verifier.TestMemberIsUndefined(inbound_stream.total_audio_energy);
verifier.TestMemberIsUndefined(inbound_stream.total_samples_duration);
verifier.TestMemberIsNonNegative<int32_t>(inbound_stream.frames_received);
} else {
verifier.TestMemberIsNonNegative<double>(inbound_stream.jitter);
verifier.TestMemberIsNonNegative<double>(
inbound_stream.jitter_buffer_delay);
verifier.TestMemberIsNonNegative<uint64_t>(
inbound_stream.jitter_buffer_emitted_count);
verifier.TestMemberIsPositive<uint64_t>(
inbound_stream.total_samples_received);
verifier.TestMemberIsNonNegative<uint64_t>(
inbound_stream.concealed_samples);
verifier.TestMemberIsNonNegative<uint64_t>(
inbound_stream.silent_concealed_samples);
verifier.TestMemberIsNonNegative<uint64_t>(
inbound_stream.concealment_events);
verifier.TestMemberIsNonNegative<uint64_t>(
inbound_stream.inserted_samples_for_deceleration);
verifier.TestMemberIsNonNegative<uint64_t>(
inbound_stream.removed_samples_for_acceleration);
verifier.TestMemberIsPositive<double>(inbound_stream.audio_level);
verifier.TestMemberIsPositive<double>(inbound_stream.total_audio_energy);
verifier.TestMemberIsPositive<double>(
inbound_stream.total_samples_duration);
verifier.TestMemberIsUndefined(inbound_stream.frames_received);
}
verifier.TestMemberIsUndefined(inbound_stream.round_trip_time);
verifier.TestMemberIsUndefined(inbound_stream.packets_discarded);
verifier.TestMemberIsUndefined(inbound_stream.packets_repaired);
@ -843,6 +892,7 @@ class RTCStatsReportVerifier {
*inbound_stream.media_type == "video") {
verifier.TestMemberIsDefined(inbound_stream.frames_decoded);
verifier.TestMemberIsDefined(inbound_stream.key_frames_decoded);
verifier.TestMemberIsNonNegative<uint32_t>(inbound_stream.frames_dropped);
verifier.TestMemberIsNonNegative<double>(
inbound_stream.total_decode_time);
verifier.TestMemberIsNonNegative<double>(
@ -855,6 +905,7 @@ class RTCStatsReportVerifier {
} else {
verifier.TestMemberIsUndefined(inbound_stream.frames_decoded);
verifier.TestMemberIsUndefined(inbound_stream.key_frames_decoded);
verifier.TestMemberIsUndefined(inbound_stream.frames_dropped);
verifier.TestMemberIsUndefined(inbound_stream.total_decode_time);
verifier.TestMemberIsUndefined(inbound_stream.total_inter_frame_delay);
verifier.TestMemberIsUndefined(

View File

@ -604,6 +604,18 @@ WEBRTC_RTCSTATS_IMPL(
&packets_lost,
&last_packet_received_timestamp,
&jitter,
&jitter_buffer_delay,
&jitter_buffer_emitted_count,
&total_samples_received,
&concealed_samples,
&silent_concealed_samples,
&concealment_events,
&inserted_samples_for_deceleration,
&removed_samples_for_acceleration,
&audio_level,
&total_audio_energy,
&total_samples_duration,
&frames_received,
&round_trip_time,
&packets_discarded,
&packets_repaired,
@ -615,8 +627,13 @@ WEBRTC_RTCSTATS_IMPL(
&burst_discard_rate,
&gap_loss_rate,
&gap_discard_rate,
&frame_width,
&frame_height,
&frame_bit_depth,
&frames_per_second,
&frames_decoded,
&key_frames_decoded,
&frames_dropped,
&total_decode_time,
&total_inter_frame_delay,
&total_squared_inter_frame_delay,
@ -640,6 +657,18 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
packets_lost("packetsLost"),
last_packet_received_timestamp("lastPacketReceivedTimestamp"),
jitter("jitter"),
jitter_buffer_delay("jitterBufferDelay"),
jitter_buffer_emitted_count("jitterBufferEmittedCount"),
total_samples_received("totalSamplesReceived"),
concealed_samples("concealedSamples"),
silent_concealed_samples("silentConcealedSamples"),
concealment_events("concealmentEvents"),
inserted_samples_for_deceleration("insertedSamplesForDeceleration"),
removed_samples_for_acceleration("removedSamplesForAcceleration"),
audio_level("audioLevel"),
total_audio_energy("totalAudioEnergy"),
total_samples_duration("totalSamplesDuration"),
frames_received("framesReceived"),
round_trip_time("roundTripTime"),
packets_discarded("packetsDiscarded"),
packets_repaired("packetsRepaired"),
@ -651,8 +680,13 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(std::string&& id,
burst_discard_rate("burstDiscardRate"),
gap_loss_rate("gapLossRate"),
gap_discard_rate("gapDiscardRate"),
frame_width("frameWidth"),
frame_height("frameHeight"),
frame_bit_depth("frameBitDepth"),
frames_per_second("framesPerSecond"),
frames_decoded("framesDecoded"),
key_frames_decoded("keyFramesDecoded"),
frames_dropped("framesDropped"),
total_decode_time("totalDecodeTime"),
total_inter_frame_delay("totalInterFrameDelay"),
total_squared_inter_frame_delay("totalSquaredInterFrameDelay"),
@ -671,6 +705,19 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
packets_lost(other.packets_lost),
last_packet_received_timestamp(other.last_packet_received_timestamp),
jitter(other.jitter),
jitter_buffer_delay(other.jitter_buffer_delay),
jitter_buffer_emitted_count(other.jitter_buffer_emitted_count),
total_samples_received(other.total_samples_received),
concealed_samples(other.concealed_samples),
silent_concealed_samples(other.silent_concealed_samples),
concealment_events(other.concealment_events),
inserted_samples_for_deceleration(
other.inserted_samples_for_deceleration),
removed_samples_for_acceleration(other.removed_samples_for_acceleration),
audio_level(other.audio_level),
total_audio_energy(other.total_audio_energy),
total_samples_duration(other.total_samples_duration),
frames_received(other.frames_received),
round_trip_time(other.round_trip_time),
packets_discarded(other.packets_discarded),
packets_repaired(other.packets_repaired),
@ -682,8 +729,13 @@ RTCInboundRTPStreamStats::RTCInboundRTPStreamStats(
burst_discard_rate(other.burst_discard_rate),
gap_loss_rate(other.gap_loss_rate),
gap_discard_rate(other.gap_discard_rate),
frame_width(other.frame_width),
frame_height(other.frame_height),
frame_bit_depth(other.frame_bit_depth),
frames_per_second(other.frames_per_second),
frames_decoded(other.frames_decoded),
key_frames_decoded(other.key_frames_decoded),
frames_dropped(other.frames_dropped),
total_decode_time(other.total_decode_time),
total_inter_frame_delay(other.total_inter_frame_delay),
total_squared_inter_frame_delay(other.total_squared_inter_frame_delay),
@ -712,6 +764,9 @@ WEBRTC_RTCSTATS_IMPL(
&frame_width,
&frame_height,
&frames_per_second,
&frame_width,
&frame_height,
&frames_per_second,
&frames_sent,
&huge_frames_sent,
&total_packet_send_delay,