Fix unit for inbound RTP stat `lastPacketReceivedTimestamp` (s -> ms)
Both inbound RTP stats `estimatedPlayoutTimestamp` and
`lastPacketReceivedTimestamp` are surfaced to JS land as
`DOMHighResTimeStamp` - i.e., time values in milliseconds.
This CL fixes `lastPacketReceivedTimestamp` which is incorrectly
surfaced as time value in seconds.
Bug: webrtc:12605
Change-Id: I290103071cca3331d2a3066b6b6b9fcb4f4fd0af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212742
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33530}
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index 122ae9f..6f5f035 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -347,10 +347,8 @@
// |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) {
- inbound_audio->last_packet_received_timestamp =
- static_cast<double>(
- *voice_receiver_info.last_packet_received_timestamp_ms) /
- rtc::kNumMillisecsPerSec;
+ inbound_audio->last_packet_received_timestamp = static_cast<double>(
+ *voice_receiver_info.last_packet_received_timestamp_ms);
}
if (voice_receiver_info.estimated_playout_ntp_timestamp_ms) {
inbound_audio->estimated_playout_timestamp = static_cast<double>(
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 6134846..1516bba 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -1864,7 +1864,7 @@
// Set previously undefined values and "GetStats" again.
voice_media_info.receivers[0].last_packet_received_timestamp_ms = 3000;
- expected_audio.last_packet_received_timestamp = 3.0;
+ expected_audio.last_packet_received_timestamp = 3000.0;
voice_media_info.receivers[0].estimated_playout_ntp_timestamp_ms = 4567;
expected_audio.estimated_playout_timestamp = 4567;
voice_media_channel->SetStats(voice_media_info);