Add jitterBufferDelay and jitterBufferEmittedCount stats for video
jitterBufferDelay and jitterBufferEmittedCount are defined
in RTCMediaStreamStats for both audio and video.
But for video, they were not populated in RTCInboundRtpStreamStats.
Bug: webrtc:12910
Change-Id: I135d473f055ecfb2c39b078ccf18c1bb9bc4f210
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224280
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34398}
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index a4a925e..e9d4870 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -426,6 +426,12 @@
int64_t header_and_padding_bytes_rcvd = 0;
int packets_rcvd = 0;
int packets_lost = 0;
+ // Jitter (network-related) latency (cumulative).
+ // https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-jitterbufferdelay
+ double jitter_buffer_delay_seconds = 0.0;
+ // Number of observations for cumulative jitter latency.
+ // https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-jitterbufferemittedcount
+ uint64_t jitter_buffer_emitted_count = 0;
// The timestamp at which the last packet was received, i.e. the time of the
// local clock when it was received - not the RTP timestamp of that packet.
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-lastpacketreceivedtimestamp
@@ -469,8 +475,6 @@
uint64_t concealed_samples = 0;
uint64_t silent_concealed_samples = 0;
uint64_t concealment_events = 0;
- double jitter_buffer_delay_seconds = 0.0;
- uint64_t jitter_buffer_emitted_count = 0;
double jitter_buffer_target_delay_seconds = 0.0;
uint64_t inserted_samples_for_deceleration = 0;
uint64_t removed_samples_for_acceleration = 0;
@@ -616,12 +620,6 @@
int max_decode_ms = 0;
// Jitter (network-related) latency.
int jitter_buffer_ms = 0;
- // Jitter (network-related) latency (cumulative).
- // https://w3c.github.io/webrtc-stats/#dom-rtcvideoreceiverstats-jitterbufferdelay
- double jitter_buffer_delay_seconds = 0;
- // Number of observations for cumulative jitter latency.
- // https://w3c.github.io/webrtc-stats/#dom-rtcvideoreceiverstats-jitterbufferemittedcount
- uint64_t jitter_buffer_emitted_count = 0;
// Requested minimum playout latency.
int min_playout_delay_ms = 0;
// Requested latency to account for rendering delay.
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index 2049d83..1fa731b 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -333,6 +333,10 @@
static_cast<uint64_t>(media_receiver_info.header_and_padding_bytes_rcvd);
inbound_stats->packets_lost =
static_cast<int32_t>(media_receiver_info.packets_lost);
+ inbound_stats->jitter_buffer_delay =
+ media_receiver_info.jitter_buffer_delay_seconds;
+ inbound_stats->jitter_buffer_emitted_count =
+ media_receiver_info.jitter_buffer_emitted_count;
}
std::unique_ptr<RTCInboundRTPStreamStats> CreateInboundAudioStreamStats(
@@ -353,10 +357,6 @@
}
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;
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 62b2c4d..8454541 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -1737,7 +1737,7 @@
voice_receiver_info.inserted_samples_for_deceleration = 987;
voice_receiver_info.removed_samples_for_acceleration = 876;
voice_receiver_info.silent_concealed_samples = 765;
- voice_receiver_info.jitter_buffer_delay_seconds = 3456;
+ voice_receiver_info.jitter_buffer_delay_seconds = 3.456;
voice_receiver_info.jitter_buffer_emitted_count = 13;
voice_receiver_info.jitter_buffer_target_delay_seconds = 7.894;
voice_receiver_info.jitter_buffer_flushes = 7;
@@ -1782,7 +1782,7 @@
expected_remote_audio_track.inserted_samples_for_deceleration = 987;
expected_remote_audio_track.removed_samples_for_acceleration = 876;
expected_remote_audio_track.silent_concealed_samples = 765;
- expected_remote_audio_track.jitter_buffer_delay = 3456;
+ expected_remote_audio_track.jitter_buffer_delay = 3.456;
expected_remote_audio_track.jitter_buffer_emitted_count = 13;
expected_remote_audio_track.jitter_buffer_target_delay = 7.894;
expected_remote_audio_track.jitter_buffer_flushes = 7;
@@ -2068,6 +2068,8 @@
video_media_info.receivers[0].total_inter_frame_delay = 0.123;
video_media_info.receivers[0].total_squared_inter_frame_delay = 0.00456;
video_media_info.receivers[0].jitter_ms = 1199;
+ video_media_info.receivers[0].jitter_buffer_delay_seconds = 3.456;
+ video_media_info.receivers[0].jitter_buffer_emitted_count = 13;
video_media_info.receivers[0].last_packet_received_timestamp_ms =
absl::nullopt;
@@ -2115,6 +2117,8 @@
expected_video.total_inter_frame_delay = 0.123;
expected_video.total_squared_inter_frame_delay = 0.00456;
expected_video.jitter = 1.199;
+ expected_video.jitter_buffer_delay = 3.456;
+ expected_video.jitter_buffer_emitted_count = 13;
// |expected_video.last_packet_received_timestamp| should be undefined.
// |expected_video.content_type| should be undefined.
// |expected_video.decoder_implementation| should be undefined.
diff --git a/pc/rtc_stats_integrationtest.cc b/pc/rtc_stats_integrationtest.cc
index 90be600..c15ffbf 100644
--- a/pc/rtc_stats_integrationtest.cc
+++ b/pc/rtc_stats_integrationtest.cc
@@ -840,11 +840,12 @@
verifier.TestMemberIsUndefined(inbound_stream.frames_per_second);
}
verifier.TestMemberIsUndefined(inbound_stream.frame_bit_depth);
+ verifier.TestMemberIsNonNegative<double>(
+ inbound_stream.jitter_buffer_delay);
+ verifier.TestMemberIsNonNegative<uint64_t>(
+ inbound_stream.jitter_buffer_emitted_count);
if (inbound_stream.media_type.is_defined() &&
*inbound_stream.media_type == "video") {
- 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);
@@ -864,10 +865,6 @@
verifier.TestMemberIsUndefined(inbound_stream.fir_count);
verifier.TestMemberIsUndefined(inbound_stream.pli_count);
verifier.TestMemberIsUndefined(inbound_stream.nack_count);
- 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>(