From 79011ef4a7477fcd9a2aacb8bfed0fa4d3d62677 Mon Sep 17 00:00:00 2001 From: Alessio Bazzica Date: Wed, 10 Mar 2021 14:52:35 +0100 Subject: [PATCH] Remove `ModuleRtpRtcpImpl2::LastReceivedNTP` `LastReceivedNTP()` does not need to be part of the public members of `ModuleRtpRtcpImpl` and `ModuleRtpRtcpImpl2` since it is used only once in the same class. This change is requried by the child CL [1] which adds a public getter needed to add remote-outbound stats. [1] https://webrtc-review.googlesource.com/c/src/+/211041 Bug: webrtc:12529 Change-Id: I82cfea5ee795de37fffa3d759ce9f581ca775d55 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211043 Commit-Queue: Alessio Bazzica Reviewed-by: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#33420} --- modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 29 ++++++++--------------- modules/rtp_rtcp/source/rtp_rtcp_impl.h | 4 ---- modules/rtp_rtcp/source/rtp_rtcp_impl2.cc | 29 ++++++++--------------- modules/rtp_rtcp/source/rtp_rtcp_impl2.h | 4 ---- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 85e5478e51..62f0fac6ba 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -312,8 +312,16 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() { } state.receiver = &rtcp_receiver_; - LastReceivedNTP(&state.last_rr_ntp_secs, &state.last_rr_ntp_frac, - &state.remote_sr); + uint32_t received_ntp_secs = 0; + uint32_t received_ntp_frac = 0; + state.remote_sr = 0; + if (rtcp_receiver_.NTP(&received_ntp_secs, &received_ntp_frac, + /*rtcp_arrival_time_secs=*/&state.last_rr_ntp_secs, + /*rtcp_arrival_time_frac=*/&state.last_rr_ntp_frac, + /*rtcp_timestamp=*/nullptr)) { + state.remote_sr = ((received_ntp_secs & 0x0000ffff) << 16) + + ((received_ntp_frac & 0xffff0000) >> 16); + } state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo(); @@ -702,23 +710,6 @@ void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( } } -bool ModuleRtpRtcpImpl::LastReceivedNTP( - uint32_t* rtcp_arrival_time_secs, // When we got the last report. - uint32_t* rtcp_arrival_time_frac, - uint32_t* remote_sr) const { - // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). - uint32_t ntp_secs = 0; - uint32_t ntp_frac = 0; - - if (!rtcp_receiver_.NTP(&ntp_secs, &ntp_frac, rtcp_arrival_time_secs, - rtcp_arrival_time_frac, NULL)) { - return false; - } - *remote_sr = - ((ntp_secs & 0x0000ffff) << 16) + ((ntp_frac & 0xffff0000) >> 16); - return true; -} - void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) { { MutexLock lock(&mutex_rtt_); diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h index ec51a4c65b..9e5f3970c6 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -228,10 +228,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp { bool decodability_flag, bool buffering_allowed) override; - bool LastReceivedNTP(uint32_t* NTPsecs, - uint32_t* NTPfrac, - uint32_t* remote_sr) const; - RtpSendRates GetSendRates() const override; void OnReceivedNack( diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc index 94dc2977e0..c211aedadd 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc @@ -260,8 +260,16 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl2::GetFeedbackState() { } state.receiver = &rtcp_receiver_; - LastReceivedNTP(&state.last_rr_ntp_secs, &state.last_rr_ntp_frac, - &state.remote_sr); + uint32_t received_ntp_secs = 0; + uint32_t received_ntp_frac = 0; + state.remote_sr = 0; + if (rtcp_receiver_.NTP(&received_ntp_secs, &received_ntp_frac, + /*rtcp_arrival_time_secs=*/&state.last_rr_ntp_secs, + /*rtcp_arrival_time_frac=*/&state.last_rr_ntp_frac, + /*rtcp_timestamp=*/nullptr)) { + state.remote_sr = ((received_ntp_secs & 0x0000ffff) << 16) + + ((received_ntp_frac & 0xffff0000) >> 16); + } state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo(); @@ -668,23 +676,6 @@ void ModuleRtpRtcpImpl2::OnReceivedRtcpReportBlocks( } } -bool ModuleRtpRtcpImpl2::LastReceivedNTP( - uint32_t* rtcp_arrival_time_secs, // When we got the last report. - uint32_t* rtcp_arrival_time_frac, - uint32_t* remote_sr) const { - // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). - uint32_t ntp_secs = 0; - uint32_t ntp_frac = 0; - - if (!rtcp_receiver_.NTP(&ntp_secs, &ntp_frac, rtcp_arrival_time_secs, - rtcp_arrival_time_frac, NULL)) { - return false; - } - *remote_sr = - ((ntp_secs & 0x0000ffff) << 16) + ((ntp_frac & 0xffff0000) >> 16); - return true; -} - void ModuleRtpRtcpImpl2::set_rtt_ms(int64_t rtt_ms) { RTC_DCHECK_RUN_ON(worker_queue_); { diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h index a4a7ff5fe7..cd216c937c 100644 --- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h +++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h @@ -240,10 +240,6 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface, bool decodability_flag, bool buffering_allowed) override; - bool LastReceivedNTP(uint32_t* NTPsecs, - uint32_t* NTPfrac, - uint32_t* remote_sr) const; - RtpSendRates GetSendRates() const override; void OnReceivedNack(