Stop trying to compensate for the offset between the different NTP clocks.
There is only one NTP clock now.
Bug: webrtc:11327
Change-Id: I8c2808cf665f92bd251d68e32062beeffabb0f43
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214132
Commit-Queue: Paul Hallak <phallak@google.com>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33657}
diff --git a/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc b/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc
index 131118f..723064e 100644
--- a/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc
+++ b/modules/rtp_rtcp/source/remote_ntp_time_estimator.cc
@@ -52,8 +52,7 @@
// Update extrapolator with the new arrival time.
// The extrapolator assumes the ntp time.
- int64_t receiver_arrival_time_ms =
- clock_->TimeInMilliseconds() + NtpOffsetMs();
+ int64_t receiver_arrival_time_ms = clock_->CurrentNtpInMilliseconds();
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 =
@@ -73,16 +72,7 @@
int64_t receiver_capture_ntp_ms =
sender_capture_ntp_ms + remote_to_local_clocks_offset;
- // TODO(bugs.webrtc.org/11327): Clock::CurrentNtpInMilliseconds() was
- // previously used to calculate the offset between the local and the remote
- // clock. However, rtc::TimeMillis() + NtpOffsetMs() is now used as the local
- // ntp clock value. To preserve the old behavior of this method, the return
- // value is adjusted with the difference between the two local ntp clocks.
int64_t now_ms = clock_->TimeInMilliseconds();
- int64_t offset_between_local_ntp_clocks =
- clock_->CurrentNtpInMilliseconds() - now_ms - NtpOffsetMs();
- receiver_capture_ntp_ms += offset_between_local_ntp_clocks;
-
if (now_ms - last_timing_log_ms_ > kTimingLogIntervalMs) {
RTC_LOG(LS_INFO) << "RTP timestamp: " << rtp_timestamp
<< " in NTP clock: " << sender_capture_ntp_ms
@@ -90,6 +80,7 @@
<< receiver_capture_ntp_ms;
last_timing_log_ms_ = now_ms;
}
+
return receiver_capture_ntp_ms;
}
diff --git a/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc b/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc
index 85f0848..73c3e9b 100644
--- a/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc
+++ b/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc
@@ -10,7 +10,6 @@
#include "modules/rtp_rtcp/include/remote_ntp_time_estimator.h"
#include "absl/types/optional.h"
-#include "modules/rtp_rtcp/source/time_util.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/ntp_time.h"
#include "test/gmock.h"
@@ -43,9 +42,7 @@
kTimestampOffset;
}
- NtpTime GetRemoteNtpTime() {
- return TimeMicrosToNtp(remote_clock_.TimeInMicroseconds());
- }
+ NtpTime GetRemoteNtpTime() { return remote_clock_.CurrentNtpTime(); }
void SendRtcpSr() {
uint32_t rtcp_timestamp = GetRemoteTimestamp();