rename timestamps to show epoch

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 <brandstrom@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43194}
This commit is contained in:
Olov Brändström 2024-10-07 12:46:28 +02:00 committed by WebRTC LUCI CQ
parent e3819f6ac3
commit b9c4c242d4
19 changed files with 70 additions and 66 deletions

View File

@ -332,10 +332,10 @@ webrtc::AudioReceiveStreamInterface::Stats AudioReceiveStreamImpl::GetStats(
stats.decoding_plc_cng = ds.decoded_plc_cng; stats.decoding_plc_cng = ds.decoded_plc_cng;
stats.decoding_muted_output = ds.decoded_muted_output; stats.decoding_muted_output = ds.decoded_muted_output;
stats.last_sender_report_timestamp_ms = stats.last_sender_report_utc_timestamp_ms =
call_stats.last_sender_report_timestamp_ms; call_stats.last_sender_report_utc_timestamp_ms;
stats.last_sender_report_remote_timestamp_ms = stats.last_sender_report_remote_utc_timestamp_ms =
call_stats.last_sender_report_remote_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_packets_sent = call_stats.sender_reports_packets_sent;
stats.sender_reports_bytes_sent = call_stats.sender_reports_bytes_sent; stats.sender_reports_bytes_sent = call_stats.sender_reports_bytes_sent;
stats.sender_reports_reports_count = call_stats.sender_reports_reports_count; stats.sender_reports_reports_count = call_stats.sender_reports_reports_count;

View File

@ -777,7 +777,7 @@ void ChannelReceive::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
{ {
MutexLock lock(&ts_stats_lock_); 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); last_sr->last_remote_rtp_timestamp);
std::optional<int64_t> remote_to_local_clock_offset = std::optional<int64_t> remote_to_local_clock_offset =
ntp_estimator_.EstimateRemoteToLocalClockOffset(); ntp_estimator_.EstimateRemoteToLocalClockOffset();
@ -872,11 +872,12 @@ CallReceiveStatistics ChannelReceive::GetRTCPStatistics() const {
std::optional<RtpRtcpInterface::SenderReportStats> rtcp_sr_stats = std::optional<RtpRtcpInterface::SenderReportStats> rtcp_sr_stats =
rtp_rtcp_->GetSenderReportStats(); rtp_rtcp_->GetSenderReportStats();
if (rtcp_sr_stats.has_value()) { if (rtcp_sr_stats.has_value()) {
stats.last_sender_report_timestamp_ms = stats.last_sender_report_utc_timestamp_ms =
rtcp_sr_stats->last_arrival_timestamp.ToMs() - 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; 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_packets_sent = rtcp_sr_stats->packets_sent;
stats.sender_reports_bytes_sent = rtcp_sr_stats->bytes_sent; stats.sender_reports_bytes_sent = rtcp_sr_stats->bytes_sent;
stats.sender_reports_reports_count = rtcp_sr_stats->reports_count; stats.sender_reports_reports_count = rtcp_sr_stats->reports_count;
@ -1127,8 +1128,8 @@ std::optional<Syncable::Info> ChannelReceive::GetSyncInfo() const {
if (!last_sr.has_value()) { if (!last_sr.has_value()) {
return std::nullopt; return std::nullopt;
} }
info.capture_time_ntp_secs = last_sr->last_remote_timestamp.seconds(); info.capture_time_ntp_secs = last_sr->last_remote_ntp_timestamp.seconds();
info.capture_time_ntp_frac = last_sr->last_remote_timestamp.fractions(); info.capture_time_ntp_frac = last_sr->last_remote_ntp_timestamp.fractions();
info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp; info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp;
if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_ms_) { if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_ms_) {

View File

@ -67,8 +67,8 @@ struct CallReceiveStatistics {
// Note that the timestamps below correspond to the time elapsed since the // Note that the timestamps below correspond to the time elapsed since the
// Unix epoch. // Unix epoch.
// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
std::optional<int64_t> last_sender_report_timestamp_ms; std::optional<int64_t> last_sender_report_utc_timestamp_ms;
std::optional<int64_t> last_sender_report_remote_timestamp_ms; std::optional<int64_t> last_sender_report_remote_utc_timestamp_ms;
uint64_t sender_reports_packets_sent = 0; uint64_t sender_reports_packets_sent = 0;
uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_bytes_sent = 0;
uint64_t sender_reports_reports_count = 0; uint64_t sender_reports_reports_count = 0;

View File

@ -237,7 +237,7 @@ void AudioIngress::ReceivedRTCPPacket(
{ {
MutexLock lock(&lock_); 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); last_sr->last_remote_rtp_timestamp);
} }
} }

View File

@ -100,8 +100,8 @@ class AudioReceiveStreamInterface : public MediaReceiveStreamInterface {
std::optional<int64_t> estimated_playout_ntp_timestamp_ms; std::optional<int64_t> estimated_playout_ntp_timestamp_ms;
// Remote outbound stats derived by the received RTCP sender reports. // Remote outbound stats derived by the received RTCP sender reports.
// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
std::optional<int64_t> last_sender_report_timestamp_ms; std::optional<int64_t> last_sender_report_utc_timestamp_ms;
std::optional<int64_t> last_sender_report_remote_timestamp_ms; std::optional<int64_t> last_sender_report_remote_utc_timestamp_ms;
uint64_t sender_reports_packets_sent = 0; uint64_t sender_reports_packets_sent = 0;
uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_bytes_sent = 0;
uint64_t sender_reports_reports_count = 0; uint64_t sender_reports_reports_count = 0;

View File

@ -175,8 +175,8 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
// Remote outbound stats derived by the received RTCP sender reports. // Remote outbound stats derived by the received RTCP sender reports.
// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
std::optional<int64_t> last_sender_report_timestamp_ms; std::optional<int64_t> last_sender_report_utc_timestamp_ms;
std::optional<int64_t> last_sender_report_remote_timestamp_ms; std::optional<int64_t> last_sender_report_remote_utc_timestamp_ms;
uint32_t sender_reports_packets_sent = 0; uint32_t sender_reports_packets_sent = 0;
uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_bytes_sent = 0;
uint64_t sender_reports_reports_count = 0; uint64_t sender_reports_reports_count = 0;

View File

@ -482,8 +482,8 @@ struct MediaReceiverInfo {
// Remote outbound stats derived by the received RTCP sender reports. // Remote outbound stats derived by the received RTCP sender reports.
// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict* // https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
std::optional<int64_t> last_sender_report_timestamp_ms; std::optional<int64_t> last_sender_report_utc_timestamp_ms;
std::optional<int64_t> last_sender_report_remote_timestamp_ms; std::optional<int64_t> last_sender_report_remote_utc_timestamp_ms;
uint64_t sender_reports_packets_sent = 0; uint64_t sender_reports_packets_sent = 0;
uint64_t sender_reports_bytes_sent = 0; uint64_t sender_reports_bytes_sent = 0;
uint64_t sender_reports_reports_count = 0; uint64_t sender_reports_reports_count = 0;

View File

@ -3844,9 +3844,10 @@ WebRtcVideoReceiveChannel::WebRtcVideoReceiveStream::GetVideoReceiverInfo(
} }
// remote-outbound-rtp stats. // remote-outbound-rtp stats.
info.last_sender_report_timestamp_ms = stats.last_sender_report_timestamp_ms; info.last_sender_report_utc_timestamp_ms =
info.last_sender_report_remote_timestamp_ms = stats.last_sender_report_utc_timestamp_ms;
stats.last_sender_report_remote_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_packets_sent = stats.sender_reports_packets_sent;
info.sender_reports_bytes_sent = stats.sender_reports_bytes_sent; info.sender_reports_bytes_sent = stats.sender_reports_bytes_sent;
info.sender_reports_reports_count = stats.sender_reports_reports_count; info.sender_reports_reports_count = stats.sender_reports_reports_count;

View File

@ -2697,10 +2697,10 @@ bool WebRtcVoiceReceiveChannel::GetStats(VoiceMediaReceiveInfo* info,
stats.relative_packet_arrival_delay_seconds; stats.relative_packet_arrival_delay_seconds;
rinfo.interruption_count = stats.interruption_count; rinfo.interruption_count = stats.interruption_count;
rinfo.total_interruption_duration_ms = stats.total_interruption_duration_ms; rinfo.total_interruption_duration_ms = stats.total_interruption_duration_ms;
rinfo.last_sender_report_timestamp_ms = rinfo.last_sender_report_utc_timestamp_ms =
stats.last_sender_report_timestamp_ms; stats.last_sender_report_utc_timestamp_ms;
rinfo.last_sender_report_remote_timestamp_ms = rinfo.last_sender_report_remote_utc_timestamp_ms =
stats.last_sender_report_remote_timestamp_ms; stats.last_sender_report_remote_utc_timestamp_ms;
rinfo.sender_reports_packets_sent = stats.sender_reports_packets_sent; rinfo.sender_reports_packets_sent = stats.sender_reports_packets_sent;
rinfo.sender_reports_bytes_sent = stats.sender_reports_bytes_sent; rinfo.sender_reports_bytes_sent = stats.sender_reports_bytes_sent;
rinfo.sender_reports_reports_count = stats.sender_reports_reports_count; rinfo.sender_reports_reports_count = stats.sender_reports_reports_count;

View File

@ -253,7 +253,7 @@ int64_t RTCPReceiver::LastReceivedReportBlockMs() const {
void RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) { void RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) {
MutexLock lock(&rtcp_receiver_lock_); MutexLock lock(&rtcp_receiver_lock_);
// New SSRC reset old reports. // New SSRC reset old reports.
remote_sender_.last_arrival_timestamp.Reset(); remote_sender_.last_arrival_ntp_timestamp.Reset();
remote_ssrc_ = ssrc; remote_ssrc_ = ssrc;
} }
@ -356,7 +356,7 @@ std::optional<TimeDelta> RTCPReceiver::OnPeriodicRttUpdate(Timestamp newer_than,
std::optional<RtpRtcpInterface::SenderReportStats> std::optional<RtpRtcpInterface::SenderReportStats>
RTCPReceiver::GetSenderReportStats() const { RTCPReceiver::GetSenderReportStats() const {
MutexLock lock(&rtcp_receiver_lock_); MutexLock lock(&rtcp_receiver_lock_);
if (!remote_sender_.last_arrival_timestamp.Valid()) { if (!remote_sender_.last_arrival_ntp_timestamp.Valid()) {
return std::nullopt; 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. // Only signal that we have received a SR when we accept one.
packet_information->packet_type_flags |= kRtcpSr; 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_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_.packets_sent = sender_report.sender_packet_count();
remote_sender_.bytes_sent = sender_report.sender_octet_count(); remote_sender_.bytes_sent = sender_report.sender_octet_count();
remote_sender_.reports_count++; remote_sender_.reports_count++;

View File

@ -301,8 +301,8 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() {
if (std::optional<RtpRtcpInterface::SenderReportStats> last_sr = if (std::optional<RtpRtcpInterface::SenderReportStats> last_sr =
rtcp_receiver_.GetSenderReportStats(); rtcp_receiver_.GetSenderReportStats();
last_sr.has_value()) { last_sr.has_value()) {
state.remote_sr = CompactNtp(last_sr->last_remote_timestamp); state.remote_sr = CompactNtp(last_sr->last_remote_ntp_timestamp);
state.last_rr = last_sr->last_arrival_timestamp; state.last_rr = last_sr->last_arrival_ntp_timestamp;
} }
state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo(); state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo();

View File

@ -272,8 +272,8 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl2::GetFeedbackState() {
if (std::optional<RtpRtcpInterface::SenderReportStats> last_sr = if (std::optional<RtpRtcpInterface::SenderReportStats> last_sr =
rtcp_receiver_.GetSenderReportStats(); rtcp_receiver_.GetSenderReportStats();
last_sr.has_value()) { last_sr.has_value()) {
state.remote_sr = CompactNtp(last_sr->last_remote_timestamp); state.remote_sr = CompactNtp(last_sr->last_remote_ntp_timestamp);
state.last_rr = last_sr->last_arrival_timestamp; state.last_rr = last_sr->last_arrival_ntp_timestamp;
} }
state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo(); state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo();

View File

@ -811,11 +811,11 @@ TEST_F(RtpRtcpImpl2Test, SenderReportStatsCheckStatsFromLastReport) {
auto raw_packet = sr.Build(); auto raw_packet = sr.Build();
receiver_.impl_->IncomingRtcpPacket(raw_packet); receiver_.impl_->IncomingRtcpPacket(raw_packet);
EXPECT_THAT( EXPECT_THAT(receiver_.impl_->GetSenderReportStats(),
receiver_.impl_->GetSenderReportStats(), Optional(AllOf(
Optional(AllOf(Field(&SenderReportStats::last_remote_timestamp, Eq(ntp)), Field(&SenderReportStats::last_remote_ntp_timestamp, Eq(ntp)),
Field(&SenderReportStats::packets_sent, Eq(kPacketCount)), Field(&SenderReportStats::packets_sent, Eq(kPacketCount)),
Field(&SenderReportStats::bytes_sent, Eq(kOctetCount))))); Field(&SenderReportStats::bytes_sent, Eq(kOctetCount)))));
} }
// Checks that the sender report stats count equals the number of sent RTCP SRs. // Checks that the sender report stats count equals the number of sent RTCP SRs.
@ -845,7 +845,7 @@ TEST_F(RtpRtcpImpl2Test, SenderReportStatsArrivalTimestampSet) {
AdvanceTime(kOneWayNetworkDelay); AdvanceTime(kOneWayNetworkDelay);
auto stats = receiver_.impl_->GetSenderReportStats(); auto stats = receiver_.impl_->GetSenderReportStats();
ASSERT_THAT(stats, Not(Eq(std::nullopt))); 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 // Checks that the packet and byte counters from an RTCP SR are not zero once

View File

@ -660,11 +660,11 @@ TEST_F(RtpRtcpImplTest, SenderReportStatsCheckStatsFromLastReport) {
sr.SetOctetCount(kOctetCount); sr.SetOctetCount(kOctetCount);
receiver_.impl_->IncomingRtcpPacket(sr.Build()); receiver_.impl_->IncomingRtcpPacket(sr.Build());
EXPECT_THAT( EXPECT_THAT(receiver_.impl_->GetSenderReportStats(),
receiver_.impl_->GetSenderReportStats(), Optional(AllOf(
Optional(AllOf(Field(&SenderReportStats::last_remote_timestamp, Eq(ntp)), Field(&SenderReportStats::last_remote_ntp_timestamp, Eq(ntp)),
Field(&SenderReportStats::packets_sent, Eq(kPacketCount)), Field(&SenderReportStats::packets_sent, Eq(kPacketCount)),
Field(&SenderReportStats::bytes_sent, Eq(kOctetCount))))); Field(&SenderReportStats::bytes_sent, Eq(kOctetCount)))));
} }
// Checks that the remote sender stats count equals the number of sent RTCP SRs. // 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)); ASSERT_THAT(sender_.impl_->SendRTCP(kRtcpReport), Eq(0));
auto stats = receiver_.impl_->GetSenderReportStats(); auto stats = receiver_.impl_->GetSenderReportStats();
ASSERT_THAT(stats, Not(Eq(std::nullopt))); 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 // Checks that the packet and byte counters from an RTCP SR are not zero once

View File

@ -147,9 +147,9 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
// Refer to https://tools.ietf.org/html/rfc3550#section-6.4.1. // Refer to https://tools.ietf.org/html/rfc3550#section-6.4.1.
struct SenderReportStats { struct SenderReportStats {
// Arrival NTP timestamp for the last received RTCP SR. // 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. // 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. // Received (a.k.a., remote) RTP timestamp from the last received RTCP SR.
uint32_t last_remote_rtp_timestamp = 0; uint32_t last_remote_rtp_timestamp = 0;
// Total number of RTP data packets transmitted by the sender since starting // Total number of RTP data packets transmitted by the sender since starting

View File

@ -522,7 +522,7 @@ CreateRemoteOutboundMediaStreamStats(
cricket::MediaType media_type, cricket::MediaType media_type,
const RTCInboundRtpStreamStats& inbound_audio_stats, const RTCInboundRtpStreamStats& inbound_audio_stats,
const std::string& transport_id) { 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 // Cannot create `RTCRemoteOutboundRtpStreamStats` when the RTCP SR arrival
// timestamp is not available - i.e., until the first sender report is // timestamp is not available - i.e., until the first sender report is
// received. // received.
@ -534,7 +534,8 @@ CreateRemoteOutboundMediaStreamStats(
auto stats = std::make_unique<RTCRemoteOutboundRtpStreamStats>( auto stats = std::make_unique<RTCRemoteOutboundRtpStreamStats>(
/*id=*/RTCRemoteOutboundRTPStreamStatsIDFromSSRC( /*id=*/RTCRemoteOutboundRTPStreamStatsIDFromSSRC(
media_type, media_receiver_info.ssrc()), 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. // Populate.
// - RTCRtpStreamStats. // - RTCRtpStreamStats.
@ -549,12 +550,12 @@ CreateRemoteOutboundMediaStreamStats(
stats->bytes_sent = media_receiver_info.sender_reports_bytes_sent; stats->bytes_sent = media_receiver_info.sender_reports_bytes_sent;
// - RTCRemoteOutboundRtpStreamStats. // - RTCRemoteOutboundRtpStreamStats.
stats->local_id = inbound_audio_stats.id(); stats->local_id = inbound_audio_stats.id();
// last_sender_report_remote_timestamp_ms is set together with // last_sender_report_remote_utc_timestamp_ms is set together with
// last_sender_report_timestamp_ms. // last_sender_report_utc_timestamp_ms.
RTC_DCHECK( RTC_DCHECK(media_receiver_info.last_sender_report_remote_utc_timestamp_ms
media_receiver_info.last_sender_report_remote_timestamp_ms.has_value()); .has_value());
stats->remote_timestamp = static_cast<double>( stats->remote_timestamp = static_cast<double>(
*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; stats->reports_sent = media_receiver_info.sender_reports_reports_count;
if (media_receiver_info.round_trip_time.has_value()) { if (media_receiver_info.round_trip_time.has_value()) {
stats->round_trip_time = stats->round_trip_time =

View File

@ -844,9 +844,9 @@ class RTCStatsCollectorTest : public ::testing::Test {
// remote-outbound-rtp // remote-outbound-rtp
if (add_remote_outbound_stats) { if (add_remote_outbound_stats) {
graph.remote_outbound_rtp_id = "ROA4"; 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; kRemoteOutboundStatsTimestampMs;
media_info.receivers[0].last_sender_report_remote_timestamp_ms = media_info.receivers[0].last_sender_report_remote_utc_timestamp_ms =
kRemoteOutboundStatsRemoteTimestampMs; kRemoteOutboundStatsRemoteTimestampMs;
media_info.receivers[0].sender_reports_packets_sent = media_info.receivers[0].sender_reports_packets_sent =
kRemoteOutboundStatsPacketsSent; kRemoteOutboundStatsPacketsSent;

View File

@ -382,8 +382,8 @@ std::optional<Syncable::Info> RtpVideoStreamReceiver2::GetSyncInfo() const {
if (!last_sr.has_value()) { if (!last_sr.has_value()) {
return std::nullopt; return std::nullopt;
} }
info.capture_time_ntp_secs = last_sr->last_remote_timestamp.seconds(); info.capture_time_ntp_secs = last_sr->last_remote_ntp_timestamp.seconds();
info.capture_time_ntp_frac = last_sr->last_remote_timestamp.fractions(); info.capture_time_ntp_frac = last_sr->last_remote_ntp_timestamp.fractions();
info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp; info.capture_time_source_clock = last_sr->last_remote_rtp_timestamp;
if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_) { if (!last_received_rtp_timestamp_ || !last_received_rtp_system_time_) {
@ -1210,10 +1210,10 @@ bool RtpVideoStreamReceiver2::DeliverRtcp(const uint8_t* rtcp_packet,
return true; return true;
} }
int64_t time_since_received = env_.clock().CurrentNtpInMilliseconds() - 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. // Don't use old SRs to estimate time.
if (time_since_received <= 1) { 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); last_sr->last_remote_rtp_timestamp);
std::optional<int64_t> remote_to_local_clock_offset = std::optional<int64_t> remote_to_local_clock_offset =
ntp_estimator_.EstimateRemoteToLocalClockOffset(); ntp_estimator_.EstimateRemoteToLocalClockOffset();

View File

@ -572,11 +572,12 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const {
std::optional<RtpRtcpInterface::SenderReportStats> rtcp_sr_stats = std::optional<RtpRtcpInterface::SenderReportStats> rtcp_sr_stats =
rtp_video_stream_receiver_.GetSenderReportStats(); rtp_video_stream_receiver_.GetSenderReportStats();
if (rtcp_sr_stats) { if (rtcp_sr_stats) {
stats.last_sender_report_timestamp_ms = stats.last_sender_report_utc_timestamp_ms =
rtcp_sr_stats->last_arrival_timestamp.ToMs() - 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; 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_packets_sent = rtcp_sr_stats->packets_sent;
stats.sender_reports_bytes_sent = rtcp_sr_stats->bytes_sent; stats.sender_reports_bytes_sent = rtcp_sr_stats->bytes_sent;
stats.sender_reports_reports_count = rtcp_sr_stats->reports_count; stats.sender_reports_reports_count = rtcp_sr_stats->reports_count;