From b9c4c242d4147688f2de365d32f691432060c0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olov=20Br=C3=A4ndstr=C3=B6m?= Date: Mon, 7 Oct 2024 12:46:28 +0200 Subject: [PATCH] rename timestamps to show epoch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I missed one timestamp in https://webrtc-review.googlesource.com/c/src/+/363946, meaning that the config flag that was added do not yet work for all timestamps in RTCStats objects. The RTCRemoteOutboundRtpStreamStats still has UTC timestamps even if the config flag is set. I will solve this by saving both an UTC (existing) and env (to be added) timestamp, and then let rtc_stats_collector choose timestamp based on the value of the config flag (just like RTCRemoteInboundRtpStreamStats is done in the 363946 commit). Before adding the new env_ timestamp I want to make this change. I rename the existing timestamp to show what epoch it uses (NTP or UTC). This will later make it clear which timestamp is which. So this CL will make no logical change, just renaming members. I only need to rename the last_sender_report_timestamp_ms, but opted to rename the remote timestamp as well, to be consistent with the naming convention I add in this CL. Bug: chromium:369369568 Change-Id: Icfe7cf274995b39799e1478a1bb8cdf5134f0b16 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364782 Commit-Queue: Olov Brändström Reviewed-by: Henrik Boström Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#43194} --- audio/audio_receive_stream.cc | 8 ++++---- audio/channel_receive.cc | 15 ++++++++------- audio/channel_receive.h | 4 ++-- audio/voip/audio_ingress.cc | 2 +- call/audio_receive_stream.h | 4 ++-- call/video_receive_stream.h | 4 ++-- media/base/media_channel.h | 4 ++-- media/engine/webrtc_video_engine.cc | 7 ++++--- media/engine/webrtc_voice_engine.cc | 8 ++++---- modules/rtp_rtcp/source/rtcp_receiver.cc | 8 ++++---- modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 4 ++-- modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 4 ++-- .../rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc | 12 ++++++------ modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc | 12 ++++++------ modules/rtp_rtcp/source/rtp_rtcp_interface.h | 4 ++-- pc/rtc_stats_collector.cc | 15 ++++++++------- pc/rtc_stats_collector_unittest.cc | 4 ++-- video/rtp_video_stream_receiver2.cc | 8 ++++---- video/video_receive_stream2.cc | 9 +++++---- 19 files changed, 70 insertions(+), 66 deletions(-) diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc index 269c85103b..948f19804a 100644 --- a/audio/audio_receive_stream.cc +++ b/audio/audio_receive_stream.cc @@ -332,10 +332,10 @@ webrtc::AudioReceiveStreamInterface::Stats AudioReceiveStreamImpl::GetStats( stats.decoding_plc_cng = ds.decoded_plc_cng; stats.decoding_muted_output = ds.decoded_muted_output; - stats.last_sender_report_timestamp_ms = - call_stats.last_sender_report_timestamp_ms; - stats.last_sender_report_remote_timestamp_ms = - call_stats.last_sender_report_remote_timestamp_ms; + stats.last_sender_report_utc_timestamp_ms = + call_stats.last_sender_report_utc_timestamp_ms; + stats.last_sender_report_remote_utc_timestamp_ms = + call_stats.last_sender_report_remote_utc_timestamp_ms; stats.sender_reports_packets_sent = call_stats.sender_reports_packets_sent; stats.sender_reports_bytes_sent = call_stats.sender_reports_bytes_sent; stats.sender_reports_reports_count = call_stats.sender_reports_reports_count; diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc index ca5f916ea4..da58924baf 100644 --- a/audio/channel_receive.cc +++ b/audio/channel_receive.cc @@ -777,7 +777,7 @@ void ChannelReceive::ReceivedRTCPPacket(const uint8_t* data, size_t length) { { MutexLock lock(&ts_stats_lock_); - ntp_estimator_.UpdateRtcpTimestamp(*rtt, last_sr->last_remote_timestamp, + ntp_estimator_.UpdateRtcpTimestamp(*rtt, last_sr->last_remote_ntp_timestamp, last_sr->last_remote_rtp_timestamp); std::optional remote_to_local_clock_offset = ntp_estimator_.EstimateRemoteToLocalClockOffset(); @@ -872,11 +872,12 @@ CallReceiveStatistics ChannelReceive::GetRTCPStatistics() const { std::optional rtcp_sr_stats = rtp_rtcp_->GetSenderReportStats(); if (rtcp_sr_stats.has_value()) { - stats.last_sender_report_timestamp_ms = - rtcp_sr_stats->last_arrival_timestamp.ToMs() - + stats.last_sender_report_utc_timestamp_ms = + rtcp_sr_stats->last_arrival_ntp_timestamp.ToMs() - + rtc::kNtpJan1970Millisecs; + stats.last_sender_report_remote_utc_timestamp_ms = + rtcp_sr_stats->last_remote_ntp_timestamp.ToMs() - rtc::kNtpJan1970Millisecs; - stats.last_sender_report_remote_timestamp_ms = - rtcp_sr_stats->last_remote_timestamp.ToMs() - rtc::kNtpJan1970Millisecs; stats.sender_reports_packets_sent = rtcp_sr_stats->packets_sent; stats.sender_reports_bytes_sent = rtcp_sr_stats->bytes_sent; stats.sender_reports_reports_count = rtcp_sr_stats->reports_count; @@ -1127,8 +1128,8 @@ std::optional ChannelReceive::GetSyncInfo() const { if (!last_sr.has_value()) { return std::nullopt; } - info.capture_time_ntp_secs = last_sr->last_remote_timestamp.seconds(); - info.capture_time_ntp_frac = last_sr->last_remote_timestamp.fractions(); + info.capture_time_ntp_secs = last_sr->last_remote_ntp_timestamp.seconds(); + info.capture_time_ntp_frac = last_sr->last_remote_ntp_timestamp.fractions(); info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp; if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_ms_) { diff --git a/audio/channel_receive.h b/audio/channel_receive.h index 4e2048daac..98da20c479 100644 --- a/audio/channel_receive.h +++ b/audio/channel_receive.h @@ -67,8 +67,8 @@ struct CallReceiveStatistics { // Note that the timestamps below correspond to the time elapsed since the // Unix epoch. // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* - std::optional last_sender_report_timestamp_ms; - std::optional last_sender_report_remote_timestamp_ms; + std::optional last_sender_report_utc_timestamp_ms; + std::optional last_sender_report_remote_utc_timestamp_ms; uint64_t sender_reports_packets_sent = 0; uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_reports_count = 0; diff --git a/audio/voip/audio_ingress.cc b/audio/voip/audio_ingress.cc index 62dd4cba80..1c64b6342a 100644 --- a/audio/voip/audio_ingress.cc +++ b/audio/voip/audio_ingress.cc @@ -237,7 +237,7 @@ void AudioIngress::ReceivedRTCPPacket( { MutexLock lock(&lock_); - ntp_estimator_.UpdateRtcpTimestamp(*rtt, last_sr->last_remote_timestamp, + ntp_estimator_.UpdateRtcpTimestamp(*rtt, last_sr->last_remote_ntp_timestamp, last_sr->last_remote_rtp_timestamp); } } diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h index d91e68caa9..655f0282af 100644 --- a/call/audio_receive_stream.h +++ b/call/audio_receive_stream.h @@ -100,8 +100,8 @@ class AudioReceiveStreamInterface : public MediaReceiveStreamInterface { std::optional estimated_playout_ntp_timestamp_ms; // Remote outbound stats derived by the received RTCP sender reports. // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* - std::optional last_sender_report_timestamp_ms; - std::optional last_sender_report_remote_timestamp_ms; + std::optional last_sender_report_utc_timestamp_ms; + std::optional last_sender_report_remote_utc_timestamp_ms; uint64_t sender_reports_packets_sent = 0; uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_reports_count = 0; diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h index 08ac664edc..2e9755452d 100644 --- a/call/video_receive_stream.h +++ b/call/video_receive_stream.h @@ -175,8 +175,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface { // Remote outbound stats derived by the received RTCP sender reports. // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* - std::optional last_sender_report_timestamp_ms; - std::optional last_sender_report_remote_timestamp_ms; + std::optional last_sender_report_utc_timestamp_ms; + std::optional last_sender_report_remote_utc_timestamp_ms; uint32_t sender_reports_packets_sent = 0; uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_reports_count = 0; diff --git a/media/base/media_channel.h b/media/base/media_channel.h index 73d2b2585a..f8c1fede5b 100644 --- a/media/base/media_channel.h +++ b/media/base/media_channel.h @@ -482,8 +482,8 @@ struct MediaReceiverInfo { // Remote outbound stats derived by the received RTCP sender reports. // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* - std::optional last_sender_report_timestamp_ms; - std::optional last_sender_report_remote_timestamp_ms; + std::optional last_sender_report_utc_timestamp_ms; + std::optional last_sender_report_remote_utc_timestamp_ms; uint64_t sender_reports_packets_sent = 0; uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_reports_count = 0; diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc index a094443e97..12ee581378 100644 --- a/media/engine/webrtc_video_engine.cc +++ b/media/engine/webrtc_video_engine.cc @@ -3844,9 +3844,10 @@ WebRtcVideoReceiveChannel::WebRtcVideoReceiveStream::GetVideoReceiverInfo( } // remote-outbound-rtp stats. - info.last_sender_report_timestamp_ms = stats.last_sender_report_timestamp_ms; - info.last_sender_report_remote_timestamp_ms = - stats.last_sender_report_remote_timestamp_ms; + info.last_sender_report_utc_timestamp_ms = + stats.last_sender_report_utc_timestamp_ms; + info.last_sender_report_remote_utc_timestamp_ms = + stats.last_sender_report_remote_utc_timestamp_ms; info.sender_reports_packets_sent = stats.sender_reports_packets_sent; info.sender_reports_bytes_sent = stats.sender_reports_bytes_sent; info.sender_reports_reports_count = stats.sender_reports_reports_count; diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc index 69f2a3c811..f78d1eb03e 100644 --- a/media/engine/webrtc_voice_engine.cc +++ b/media/engine/webrtc_voice_engine.cc @@ -2697,10 +2697,10 @@ bool WebRtcVoiceReceiveChannel::GetStats(VoiceMediaReceiveInfo* info, stats.relative_packet_arrival_delay_seconds; rinfo.interruption_count = stats.interruption_count; rinfo.total_interruption_duration_ms = stats.total_interruption_duration_ms; - rinfo.last_sender_report_timestamp_ms = - stats.last_sender_report_timestamp_ms; - rinfo.last_sender_report_remote_timestamp_ms = - stats.last_sender_report_remote_timestamp_ms; + rinfo.last_sender_report_utc_timestamp_ms = + stats.last_sender_report_utc_timestamp_ms; + rinfo.last_sender_report_remote_utc_timestamp_ms = + stats.last_sender_report_remote_utc_timestamp_ms; rinfo.sender_reports_packets_sent = stats.sender_reports_packets_sent; rinfo.sender_reports_bytes_sent = stats.sender_reports_bytes_sent; rinfo.sender_reports_reports_count = stats.sender_reports_reports_count; diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc index a4ea1b0b44..4014990ecb 100644 --- a/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -253,7 +253,7 @@ int64_t RTCPReceiver::LastReceivedReportBlockMs() const { void RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) { MutexLock lock(&rtcp_receiver_lock_); // New SSRC reset old reports. - remote_sender_.last_arrival_timestamp.Reset(); + remote_sender_.last_arrival_ntp_timestamp.Reset(); remote_ssrc_ = ssrc; } @@ -356,7 +356,7 @@ std::optional RTCPReceiver::OnPeriodicRttUpdate(Timestamp newer_than, std::optional RTCPReceiver::GetSenderReportStats() const { MutexLock lock(&rtcp_receiver_lock_); - if (!remote_sender_.last_arrival_timestamp.Valid()) { + if (!remote_sender_.last_arrival_ntp_timestamp.Valid()) { return std::nullopt; } @@ -549,9 +549,9 @@ bool RTCPReceiver::HandleSenderReport(const CommonHeader& rtcp_block, // Only signal that we have received a SR when we accept one. packet_information->packet_type_flags |= kRtcpSr; - remote_sender_.last_remote_timestamp = sender_report.ntp(); + remote_sender_.last_remote_ntp_timestamp = sender_report.ntp(); remote_sender_.last_remote_rtp_timestamp = sender_report.rtp_timestamp(); - remote_sender_.last_arrival_timestamp = env_.clock().CurrentNtpTime(); + remote_sender_.last_arrival_ntp_timestamp = env_.clock().CurrentNtpTime(); remote_sender_.packets_sent = sender_report.sender_packet_count(); remote_sender_.bytes_sent = sender_report.sender_octet_count(); remote_sender_.reports_count++; diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 568b1e22d2..70f8944144 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -301,8 +301,8 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() { if (std::optional last_sr = rtcp_receiver_.GetSenderReportStats(); last_sr.has_value()) { - state.remote_sr = CompactNtp(last_sr->last_remote_timestamp); - state.last_rr = last_sr->last_arrival_timestamp; + state.remote_sr = CompactNtp(last_sr->last_remote_ntp_timestamp); + state.last_rr = last_sr->last_arrival_ntp_timestamp; } state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo(); diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc index fe21008cf1..d994075e0a 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -272,8 +272,8 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl2::GetFeedbackState() { if (std::optional last_sr = rtcp_receiver_.GetSenderReportStats(); last_sr.has_value()) { - state.remote_sr = CompactNtp(last_sr->last_remote_timestamp); - state.last_rr = last_sr->last_arrival_timestamp; + state.remote_sr = CompactNtp(last_sr->last_remote_ntp_timestamp); + state.last_rr = last_sr->last_arrival_ntp_timestamp; } state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo(); diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc index 63224e72ba..4e1862bb63 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2_unittest.cc @@ -811,11 +811,11 @@ TEST_F(RtpRtcpImpl2Test, SenderReportStatsCheckStatsFromLastReport) { auto raw_packet = sr.Build(); receiver_.impl_->IncomingRtcpPacket(raw_packet); - EXPECT_THAT( - receiver_.impl_->GetSenderReportStats(), - Optional(AllOf(Field(&SenderReportStats::last_remote_timestamp, Eq(ntp)), - Field(&SenderReportStats::packets_sent, Eq(kPacketCount)), - Field(&SenderReportStats::bytes_sent, Eq(kOctetCount))))); + EXPECT_THAT(receiver_.impl_->GetSenderReportStats(), + Optional(AllOf( + Field(&SenderReportStats::last_remote_ntp_timestamp, Eq(ntp)), + Field(&SenderReportStats::packets_sent, Eq(kPacketCount)), + Field(&SenderReportStats::bytes_sent, Eq(kOctetCount))))); } // Checks that the sender report stats count equals the number of sent RTCP SRs. @@ -845,7 +845,7 @@ TEST_F(RtpRtcpImpl2Test, SenderReportStatsArrivalTimestampSet) { AdvanceTime(kOneWayNetworkDelay); auto stats = receiver_.impl_->GetSenderReportStats(); ASSERT_THAT(stats, Not(Eq(std::nullopt))); - EXPECT_TRUE(stats->last_arrival_timestamp.Valid()); + EXPECT_TRUE(stats->last_arrival_ntp_timestamp.Valid()); } // Checks that the packet and byte counters from an RTCP SR are not zero once diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index dd69312d61..a21f9ceff2 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -660,11 +660,11 @@ TEST_F(RtpRtcpImplTest, SenderReportStatsCheckStatsFromLastReport) { sr.SetOctetCount(kOctetCount); receiver_.impl_->IncomingRtcpPacket(sr.Build()); - EXPECT_THAT( - receiver_.impl_->GetSenderReportStats(), - Optional(AllOf(Field(&SenderReportStats::last_remote_timestamp, Eq(ntp)), - Field(&SenderReportStats::packets_sent, Eq(kPacketCount)), - Field(&SenderReportStats::bytes_sent, Eq(kOctetCount))))); + EXPECT_THAT(receiver_.impl_->GetSenderReportStats(), + Optional(AllOf( + Field(&SenderReportStats::last_remote_ntp_timestamp, Eq(ntp)), + Field(&SenderReportStats::packets_sent, Eq(kPacketCount)), + Field(&SenderReportStats::bytes_sent, Eq(kOctetCount))))); } // Checks that the remote sender stats count equals the number of sent RTCP SRs. @@ -691,7 +691,7 @@ TEST_F(RtpRtcpImplTest, SenderReportStatsArrivalTimestampSet) { ASSERT_THAT(sender_.impl_->SendRTCP(kRtcpReport), Eq(0)); auto stats = receiver_.impl_->GetSenderReportStats(); ASSERT_THAT(stats, Not(Eq(std::nullopt))); - EXPECT_TRUE(stats->last_arrival_timestamp.Valid()); + EXPECT_TRUE(stats->last_arrival_ntp_timestamp.Valid()); } // Checks that the packet and byte counters from an RTCP SR are not zero once diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h index dd34cf7e3e..a6bf2df51b 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h @@ -147,9 +147,9 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface { // Refer to https://tools.ietf.org/html/rfc3550#section-6.4.1. struct SenderReportStats { // Arrival NTP timestamp for the last received RTCP SR. - NtpTime last_arrival_timestamp; + NtpTime last_arrival_ntp_timestamp; // Received (a.k.a., remote) NTP timestamp for the last received RTCP SR. - NtpTime last_remote_timestamp; + NtpTime last_remote_ntp_timestamp; // Received (a.k.a., remote) RTP timestamp from the last received RTCP SR. uint32_t last_remote_rtp_timestamp = 0; // Total number of RTP data packets transmitted by the sender since starting diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc index 29598e0ddb..08f39618c0 100644 --- a/pc/rtc_stats_collector.cc +++ b/pc/rtc_stats_collector.cc @@ -522,7 +522,7 @@ CreateRemoteOutboundMediaStreamStats( cricket::MediaType media_type, const RTCInboundRtpStreamStats& inbound_audio_stats, const std::string& transport_id) { - if (!media_receiver_info.last_sender_report_timestamp_ms.has_value()) { + if (!media_receiver_info.last_sender_report_utc_timestamp_ms.has_value()) { // Cannot create `RTCRemoteOutboundRtpStreamStats` when the RTCP SR arrival // timestamp is not available - i.e., until the first sender report is // received. @@ -534,7 +534,8 @@ CreateRemoteOutboundMediaStreamStats( auto stats = std::make_unique( /*id=*/RTCRemoteOutboundRTPStreamStatsIDFromSSRC( media_type, media_receiver_info.ssrc()), - Timestamp::Millis(*media_receiver_info.last_sender_report_timestamp_ms)); + Timestamp::Millis( + *media_receiver_info.last_sender_report_utc_timestamp_ms)); // Populate. // - RTCRtpStreamStats. @@ -549,12 +550,12 @@ CreateRemoteOutboundMediaStreamStats( stats->bytes_sent = media_receiver_info.sender_reports_bytes_sent; // - RTCRemoteOutboundRtpStreamStats. stats->local_id = inbound_audio_stats.id(); - // last_sender_report_remote_timestamp_ms is set together with - // last_sender_report_timestamp_ms. - RTC_DCHECK( - media_receiver_info.last_sender_report_remote_timestamp_ms.has_value()); + // last_sender_report_remote_utc_timestamp_ms is set together with + // last_sender_report_utc_timestamp_ms. + RTC_DCHECK(media_receiver_info.last_sender_report_remote_utc_timestamp_ms + .has_value()); stats->remote_timestamp = static_cast( - *media_receiver_info.last_sender_report_remote_timestamp_ms); + *media_receiver_info.last_sender_report_remote_utc_timestamp_ms); stats->reports_sent = media_receiver_info.sender_reports_reports_count; if (media_receiver_info.round_trip_time.has_value()) { stats->round_trip_time = diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc index cdbddf2635..fe999ef44a 100644 --- a/pc/rtc_stats_collector_unittest.cc +++ b/pc/rtc_stats_collector_unittest.cc @@ -844,9 +844,9 @@ class RTCStatsCollectorTest : public ::testing::Test { // remote-outbound-rtp if (add_remote_outbound_stats) { graph.remote_outbound_rtp_id = "ROA4"; - media_info.receivers[0].last_sender_report_timestamp_ms = + media_info.receivers[0].last_sender_report_utc_timestamp_ms = kRemoteOutboundStatsTimestampMs; - media_info.receivers[0].last_sender_report_remote_timestamp_ms = + media_info.receivers[0].last_sender_report_remote_utc_timestamp_ms = kRemoteOutboundStatsRemoteTimestampMs; media_info.receivers[0].sender_reports_packets_sent = kRemoteOutboundStatsPacketsSent; diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc index 4604180304..ef1dd75ddd 100644 --- a/video/rtp_video_stream_receiver2.cc +++ b/video/rtp_video_stream_receiver2.cc @@ -382,8 +382,8 @@ std::optional RtpVideoStreamReceiver2::GetSyncInfo() const { if (!last_sr.has_value()) { return std::nullopt; } - info.capture_time_ntp_secs = last_sr->last_remote_timestamp.seconds(); - info.capture_time_ntp_frac = last_sr->last_remote_timestamp.fractions(); + info.capture_time_ntp_secs = last_sr->last_remote_ntp_timestamp.seconds(); + info.capture_time_ntp_frac = last_sr->last_remote_ntp_timestamp.fractions(); info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp; if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_) { @@ -1210,10 +1210,10 @@ bool RtpVideoStreamReceiver2::DeliverRtcp(const uint8_t* rtcp_packet, return true; } int64_t time_since_received = env_.clock().CurrentNtpInMilliseconds() - - last_sr->last_arrival_timestamp.ToMs(); + last_sr->last_arrival_ntp_timestamp.ToMs(); // Don't use old SRs to estimate time. if (time_since_received <= 1) { - ntp_estimator_.UpdateRtcpTimestamp(*rtt, last_sr->last_remote_timestamp, + ntp_estimator_.UpdateRtcpTimestamp(*rtt, last_sr->last_remote_ntp_timestamp, last_sr->last_remote_rtp_timestamp); std::optional remote_to_local_clock_offset = ntp_estimator_.EstimateRemoteToLocalClockOffset(); diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc index 1dedc3e149..eda4f91329 100644 --- a/video/video_receive_stream2.cc +++ b/video/video_receive_stream2.cc @@ -572,11 +572,12 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const { std::optional rtcp_sr_stats = rtp_video_stream_receiver_.GetSenderReportStats(); if (rtcp_sr_stats) { - stats.last_sender_report_timestamp_ms = - rtcp_sr_stats->last_arrival_timestamp.ToMs() - + stats.last_sender_report_utc_timestamp_ms = + rtcp_sr_stats->last_arrival_ntp_timestamp.ToMs() - + rtc::kNtpJan1970Millisecs; + stats.last_sender_report_remote_utc_timestamp_ms = + rtcp_sr_stats->last_remote_ntp_timestamp.ToMs() - rtc::kNtpJan1970Millisecs; - stats.last_sender_report_remote_timestamp_ms = - rtcp_sr_stats->last_remote_timestamp.ToMs() - rtc::kNtpJan1970Millisecs; stats.sender_reports_packets_sent = rtcp_sr_stats->packets_sent; stats.sender_reports_bytes_sent = rtcp_sr_stats->bytes_sent; stats.sender_reports_reports_count = rtcp_sr_stats->reports_count;