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}
This commit is contained in:
Paul Hallak
2021-04-08 16:00:39 +02:00
committed by Commit Bot
parent e1c8a43b2a
commit 6817809e26
2 changed files with 3 additions and 15 deletions

View File

@ -52,8 +52,7 @@ bool RemoteNtpTimeEstimator::UpdateRtcpTimestamp(int64_t rtt,
// 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 RemoteNtpTimeEstimator::Estimate(uint32_t rtp_timestamp) {
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 @@ int64_t RemoteNtpTimeEstimator::Estimate(uint32_t rtp_timestamp) {
<< receiver_capture_ntp_ms;
last_timing_log_ms_ = now_ms;
}
return receiver_capture_ntp_ms;
}

View File

@ -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 @@ class RemoteNtpTimeEstimatorTest : public ::testing::Test {
kTimestampOffset;
}
NtpTime GetRemoteNtpTime() {
return TimeMicrosToNtp(remote_clock_.TimeInMicroseconds());
}
NtpTime GetRemoteNtpTime() { return remote_clock_.CurrentNtpTime(); }
void SendRtcpSr() {
uint32_t rtcp_timestamp = GetRemoteTimestamp();