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 <henrika@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Paul Hallak <phallak@google.com>
Cr-Commit-Position: refs/heads/master@{#33652}
This commit is contained in:
Paul Hallak 2021-04-06 14:37:33 +02:00 committed by Commit Bot
parent 83c726f3e5
commit 314b78d467
3 changed files with 2 additions and 7 deletions

View file

@ -15,6 +15,7 @@
#include "modules/rtp_rtcp/source/time_util.h" #include "modules/rtp_rtcp/source/time_util.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
#include "system_wrappers/include/clock.h" #include "system_wrappers/include/clock.h"
#include "system_wrappers/include/ntp_time.h"
namespace webrtc { namespace webrtc {
@ -53,7 +54,7 @@ bool RemoteNtpTimeEstimator::UpdateRtcpTimestamp(int64_t rtt,
// The extrapolator assumes the ntp time. // The extrapolator assumes the ntp time.
int64_t receiver_arrival_time_ms = int64_t receiver_arrival_time_ms =
clock_->TimeInMilliseconds() + NtpOffsetMs(); 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 sender_arrival_time_ms = sender_send_time_ms + rtt / 2;
int64_t remote_to_local_clocks_offset = int64_t remote_to_local_clocks_offset =
receiver_arrival_time_ms - sender_arrival_time_ms; receiver_arrival_time_ms - sender_arrival_time_ms;

View file

@ -45,11 +45,6 @@ class RTC_EXPORT Clock {
// Retrieve an NTP absolute timestamp in milliseconds. // Retrieve an NTP absolute timestamp in milliseconds.
virtual int64_t CurrentNtpInMilliseconds() = 0; 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. // Returns an instance of the real-time system clock implementation.
static Clock* GetRealTimeClock(); static Clock* GetRealTimeClock();
}; };

View file

@ -56,7 +56,6 @@ TEST(NtpTimeTest, ToMsMeansToNtpMilliseconds) {
SimulatedClock clock(0x123456789abc); SimulatedClock clock(0x123456789abc);
NtpTime ntp = clock.CurrentNtpTime(); NtpTime ntp = clock.CurrentNtpTime();
EXPECT_EQ(ntp.ToMs(), Clock::NtpToMs(ntp.seconds(), ntp.fractions()));
EXPECT_EQ(ntp.ToMs(), clock.CurrentNtpInMilliseconds()); EXPECT_EQ(ntp.ToMs(), clock.CurrentNtpInMilliseconds());
} }