From 46fbefa3023ca7d1c1967e92b68c343173a00db2 Mon Sep 17 00:00:00 2001 From: Paul Hallak Date: Fri, 21 May 2021 18:53:28 +0200 Subject: [PATCH] Convert to NTP time using the real clock. Bug: webrtc:11327 Change-Id: I523b111c72569580b8b27d47ad648e7887bea872 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219793 Reviewed-by: Mirko Bonadei Commit-Queue: Paul Hallak Cr-Commit-Position: refs/heads/master@{#34082} --- rtc_tools/BUILD.gn | 1 + rtc_tools/rtc_event_log_visualizer/log_simulation.cc | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn index fb8bbe9718..08f2742528 100644 --- a/rtc_tools/BUILD.gn +++ b/rtc_tools/BUILD.gn @@ -397,6 +397,7 @@ if (!build_with_chromium) { "../rtc_base:rtc_base_approved", "../rtc_base:rtc_numerics", "../rtc_base:stringutils", + "../system_wrappers", "../test:explicit_key_value_config", ] absl_deps = [ diff --git a/rtc_tools/rtc_event_log_visualizer/log_simulation.cc b/rtc_tools/rtc_event_log_visualizer/log_simulation.cc index 0e5b5d04a9..4dbaf0b041 100644 --- a/rtc_tools/rtc_event_log_visualizer/log_simulation.cc +++ b/rtc_tools/rtc_event_log_visualizer/log_simulation.cc @@ -14,6 +14,7 @@ #include "logging/rtc_event_log/rtc_event_processor.h" #include "modules/rtp_rtcp/source/time_util.h" +#include "system_wrappers/include/clock.h" namespace webrtc { @@ -142,11 +143,13 @@ void LogBasedNetworkControllerSimulation::OnReceiverReport( HandleStateUpdate(controller_->OnTransportLossReport(msg)); } + Clock* clock = Clock::GetRealTimeClock(); TimeDelta rtt = TimeDelta::PlusInfinity(); for (auto& rb : report.rr.report_blocks()) { if (rb.last_sr()) { + Timestamp report_log_time = Timestamp::Micros(report.log_time_us()); uint32_t receive_time_ntp = - CompactNtp(TimeMicrosToNtp(report.log_time_us())); + CompactNtp(clock->ConvertTimestampToNtpTime(report_log_time)); uint32_t rtt_ntp = receive_time_ntp - rb.delay_since_last_sr() - rb.last_sr(); rtt = std::min(rtt, TimeDelta::Millis(CompactNtpRttToMs(rtt_ntp)));