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}
This commit is contained in:
Alessio Bazzica 2021-03-22 15:36:53 +01:00 committed by Commit Bot
parent c303f82f4d
commit c366d51836
2 changed files with 3 additions and 5 deletions

View File

@ -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<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>(

View File

@ -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);