From 314b78d467c224159fb28c8dddf1d6fd78be7faa Mon Sep 17 00:00:00 2001 From: Paul Hallak Date: Tue, 6 Apr 2021 14:37:33 +0200 Subject: [PATCH] Remove `Clock::NtpToMs`. This helper method does not belong to the Clock class. Also, it's simple enough that it's not needed. Bug: webrtc:11327 Change-Id: I95a33f08fd568b293b591171ecaf5e7aef8d413c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214123 Reviewed-by: Henrik Andreassson Reviewed-by: Danil Chapovalov Reviewed-by: Minyue Li Commit-Queue: Paul Hallak Cr-Commit-Position: refs/heads/master@{#33652} --- modules/rtp_rtcp/source/remote_ntp_time_estimator.cc | 3 ++- system_wrappers/include/clock.h | 5 ----- system_wrappers/source/ntp_time_unittest.cc | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc b/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc index 6fed7314c0..131118f15e 100644 --- a/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc +++ b/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc @@ -15,6 +15,7 @@ #include "modules/rtp_rtcp/source/time_util.h" #include "rtc_base/logging.h" #include "system_wrappers/include/clock.h" +#include "system_wrappers/include/ntp_time.h" namespace webrtc { @@ -53,7 +54,7 @@ bool RemoteNtpTimeEstimator::UpdateRtcpTimestamp(int64_t rtt, // The extrapolator assumes the ntp time. int64_t receiver_arrival_time_ms = clock_->TimeInMilliseconds() + NtpOffsetMs(); - int64_t sender_send_time_ms = Clock::NtpToMs(ntp_secs, ntp_frac); + int64_t sender_send_time_ms = NtpTime(ntp_secs, ntp_frac).ToMs(); int64_t sender_arrival_time_ms = sender_send_time_ms + rtt / 2; int64_t remote_to_local_clocks_offset = receiver_arrival_time_ms - sender_arrival_time_ms; diff --git a/system_wrappers/include/clock.h b/system_wrappers/include/clock.h index 3c60f63da8..f70a2f4e85 100644 --- a/system_wrappers/include/clock.h +++ b/system_wrappers/include/clock.h @@ -45,11 +45,6 @@ class RTC_EXPORT Clock { // Retrieve an NTP absolute timestamp in milliseconds. virtual int64_t CurrentNtpInMilliseconds() = 0; - // Converts an NTP timestamp to a millisecond timestamp. - static int64_t NtpToMs(uint32_t seconds, uint32_t fractions) { - return NtpTime(seconds, fractions).ToMs(); - } - // Returns an instance of the real-time system clock implementation. static Clock* GetRealTimeClock(); }; diff --git a/system_wrappers/source/ntp_time_unittest.cc b/system_wrappers/source/ntp_time_unittest.cc index cdaca67fbe..0705531e37 100644 --- a/system_wrappers/source/ntp_time_unittest.cc +++ b/system_wrappers/source/ntp_time_unittest.cc @@ -56,7 +56,6 @@ TEST(NtpTimeTest, ToMsMeansToNtpMilliseconds) { SimulatedClock clock(0x123456789abc); NtpTime ntp = clock.CurrentNtpTime(); - EXPECT_EQ(ntp.ToMs(), Clock::NtpToMs(ntp.seconds(), ntp.fractions())); EXPECT_EQ(ntp.ToMs(), clock.CurrentNtpInMilliseconds()); }