From c0bdf1e36122fc99881ebeee91e52b98311108f8 Mon Sep 17 00:00:00 2001 From: Minyue Li Date: Thu, 5 Mar 2020 23:42:43 +0100 Subject: [PATCH] Feed the clock skew to AbsoluteCaptureTimeReceiver. Bug: webrtc:10739 Change-Id: Iebfb0a59f5c2c7d6a9c7e73d2b6a12985448491e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169850 Reviewed-by: Stefan Holmer Reviewed-by: Danil Chapovalov Reviewed-by: Chen Xing Commit-Queue: Minyue Li Cr-Commit-Position: refs/heads/master@{#30712} --- video/rtp_video_stream_receiver.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc index 5a6c6270be..5bc8c7e6ab 100644 --- a/video/rtp_video_stream_receiver.cc +++ b/video/rtp_video_stream_receiver.cc @@ -49,6 +49,7 @@ #include "rtc_base/strings/string_builder.h" #include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/metrics.h" +#include "system_wrappers/include/ntp_time.h" #include "video/receive_statistics_proxy.h" namespace webrtc { @@ -488,8 +489,6 @@ void RtpVideoStreamReceiver::OnReceivedPayloadData( clock_->TimeInMilliseconds()); // Try to extrapolate absolute capture time if it is missing. - // TODO(bugs.webrtc.org/10739): Add support for estimated capture clock - // offset. packet->packet_info.set_absolute_capture_time( absolute_capture_time_receiver_.OnReceivePacket( AbsoluteCaptureTimeReceiver::GetSource(packet->packet_info.ssrc(), @@ -973,6 +972,12 @@ bool RtpVideoStreamReceiver::DeliverRtcp(const uint8_t* rtcp_packet, // Don't use old SRs to estimate time. if (time_since_recieved <= 1) { ntp_estimator_.UpdateRtcpTimestamp(rtt, ntp_secs, ntp_frac, rtp_timestamp); + absl::optional remote_to_local_clock_offset_ms = + ntp_estimator_.EstimateRemoteToLocalClockOffsetMs(); + if (remote_to_local_clock_offset_ms.has_value()) { + absolute_capture_time_receiver_.SetRemoteToLocalClockOffset( + Int64MsToQ32x32(*remote_to_local_clock_offset_ms)); + } } return true;