From c366d51836a9e533fb261320e577b32af269dbbd Mon Sep 17 00:00:00 2001 From: Alessio Bazzica Date: Mon, 22 Mar 2021 15:36:53 +0100 Subject: [PATCH] Fix unit for inbound RTP stat `lastPacketReceivedTimestamp` (s -> ms) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Henrik Boström Cr-Commit-Position: refs/heads/master@{#33530} --- pc/rtc_stats_collector.cc | 6 ++---- pc/rtc_stats_collector_unittest.cc | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc index 122ae9ff5f..6f5f035b57 100644 --- a/pc/rtc_stats_collector.cc +++ b/pc/rtc_stats_collector.cc @@ -347,10 +347,8 @@ void SetInboundRTPStreamStatsFromVoiceReceiverInfo( // |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( - *voice_receiver_info.last_packet_received_timestamp_ms) / - rtc::kNumMillisecsPerSec; + inbound_audio->last_packet_received_timestamp = static_cast( + *voice_receiver_info.last_packet_received_timestamp_ms); } if (voice_receiver_info.estimated_playout_ntp_timestamp_ms) { inbound_audio->estimated_playout_timestamp = static_cast( diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc index 613484676e..1516bbaa3b 100644 --- a/pc/rtc_stats_collector_unittest.cc +++ b/pc/rtc_stats_collector_unittest.cc @@ -1864,7 +1864,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) { // 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);