Use webrtc::Clock to query for the NTP time and to convert timestamps

to NTP.

No-Try because of lack of infra lack of capacity on macs.

No-Try: True
Bug: webrtc:11327
Change-Id: Ie0c9983031a6d37ae54b1d2381c229bee1a89e8a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214134
Commit-Queue: Paul Hallak <phallak@google.com>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34078}
This commit is contained in:
Paul Hallak
2021-05-21 14:00:28 +02:00
committed by WebRTC LUCI CQ
parent 1cb796f03a
commit 00f6e75671
4 changed files with 24 additions and 32 deletions

View File

@ -332,8 +332,7 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
std::vector<rtcp::ReceiveTimeInfo> last_xr_rtis;
last_xr_rtis.reserve(last_xr_rtis_size);
const uint32_t now_ntp =
CompactNtp(TimeMicrosToNtp(clock_->TimeInMicroseconds()));
const uint32_t now_ntp = CompactNtp(clock_->CurrentNtpTime());
for (size_t i = 0; i < last_xr_rtis_size; ++i) {
RrtrInformation& rrtr = received_rrtrs_.front();
@ -481,7 +480,7 @@ void RTCPReceiver::HandleSenderReport(const CommonHeader& rtcp_block,
remote_sender_ntp_time_ = sender_report.ntp();
remote_sender_rtp_time_ = sender_report.rtp_timestamp();
last_received_sr_ntp_ = TimeMicrosToNtp(clock_->TimeInMicroseconds());
last_received_sr_ntp_ = clock_->CurrentNtpTime();
remote_sender_packet_count_ = sender_report.sender_packet_count();
remote_sender_octet_count_ = sender_report.sender_octet_count();
remote_sender_reports_count_++;
@ -571,7 +570,7 @@ void RTCPReceiver::HandleReportBlock(const ReportBlock& report_block,
uint32_t delay_ntp = report_block.delay_since_last_sr();
// Local NTP time.
uint32_t receive_time_ntp =
CompactNtp(TimeMicrosToNtp(last_received_rb_.us()));
CompactNtp(clock_->ConvertTimestampToNtpTime(last_received_rb_));
// RTT in 1/(2^16) seconds.
uint32_t rtt_ntp = receive_time_ntp - delay_ntp - send_time_ntp;
@ -774,8 +773,7 @@ void RTCPReceiver::HandleXr(const CommonHeader& rtcp_block,
void RTCPReceiver::HandleXrReceiveReferenceTime(uint32_t sender_ssrc,
const rtcp::Rrtr& rrtr) {
uint32_t received_remote_mid_ntp_time = CompactNtp(rrtr.ntp());
uint32_t local_receive_mid_ntp_time =
CompactNtp(TimeMicrosToNtp(clock_->TimeInMicroseconds()));
uint32_t local_receive_mid_ntp_time = CompactNtp(clock_->CurrentNtpTime());
auto it = received_rrtrs_ssrc_it_.find(sender_ssrc);
if (it != received_rrtrs_ssrc_it_.end()) {
@ -809,7 +807,7 @@ void RTCPReceiver::HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) {
return;
uint32_t delay_ntp = rti.delay_since_last_rr;
uint32_t now_ntp = CompactNtp(TimeMicrosToNtp(clock_->TimeInMicroseconds()));
uint32_t now_ntp = CompactNtp(clock_->CurrentNtpTime());
uint32_t rtt_ntp = now_ntp - delay_ntp - send_time_ntp;
xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp);