From 53e5e282d019c33751d2ae2775b11a14d774d6de Mon Sep 17 00:00:00 2001 From: Alessio Bazzica Date: Thu, 8 Sep 2022 16:41:08 +0200 Subject: [PATCH] Replace `ChannelReceive::GetRTT()` with `ModuleRtpRtcpImpl2::RTT()` This change increases the number of scenarios where the RTT would be available to `ChannelReceive`. That's the case since `ModuleRtpRtcpImpl2::RTT()` falls back on the DLRR-based method when the report blocks based method is unavailable - i.e., when there is no audio sender. Bug: webrtc:10739 Change-Id: Ie2451c739ab5bcfbe7844ee852bb12a97dab2ca4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274581 Commit-Queue: Alessio Bazzica Reviewed-by: Danil Chapovalov Cr-Commit-Position: refs/heads/main@{#38048} --- audio/channel_receive.cc | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc index 3847add73f..5f54c01459 100644 --- a/audio/channel_receive.cc +++ b/audio/channel_receive.cc @@ -194,7 +194,6 @@ class ChannelReceive : public ChannelReceiveInterface, RTC_RUN_ON(worker_thread_checker_); int GetRtpTimestampRateHz() const; - int64_t GetRTT() const; void OnReceivedPayloadData(rtc::ArrayView payload, const RTPHeader& rtpHeader) @@ -339,7 +338,8 @@ void ChannelReceive::OnReceivedPayloadData( } int64_t round_trip_time = 0; - rtp_rtcp_->RTT(remote_ssrc_, &round_trip_time, NULL, NULL, NULL); + rtp_rtcp_->RTT(remote_ssrc_, &round_trip_time, /*avg_rtt=*/nullptr, + /*min_rtt=*/nullptr, /*max_rtt=*/nullptr); std::vector nack_list = acm_receiver_.GetNackList(round_trip_time); if (!nack_list.empty()) { @@ -725,7 +725,9 @@ void ChannelReceive::ReceivedRTCPPacket(const uint8_t* data, size_t length) { // Deliver RTCP packet to RTP/RTCP module for parsing rtp_rtcp_->IncomingRtcpPacket(data, length); - int64_t rtt = GetRTT(); + int64_t rtt = 0; + rtp_rtcp_->RTT(remote_ssrc_, &rtt, /*avg_rtt=*/nullptr, /*min_rtt=*/nullptr, + /*max_rtt=*/nullptr); if (rtt == 0) { // Waiting for valid RTT. return; @@ -1081,27 +1083,6 @@ int ChannelReceive::GetRtpTimestampRateHz() const { : acm_receiver_.last_output_sample_rate_hz(); } -int64_t ChannelReceive::GetRTT() const { - RTC_DCHECK_RUN_ON(&network_thread_checker_); - std::vector report_blocks = - rtp_rtcp_->GetLatestReportBlockData(); - - if (report_blocks.empty()) { - // Try fall back on an RTT from an associated channel. - if (!associated_send_channel_) { - return 0; - } - return associated_send_channel_->GetRTT(); - } - - for (const ReportBlockData& data : report_blocks) { - if (data.report_block().sender_ssrc == remote_ssrc_) { - return data.last_rtt_ms(); - } - } - return 0; -} - } // namespace std::unique_ptr CreateChannelReceive(