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 <alessiob@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38048}
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index 3847add..5f54c01 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -194,7 +194,6 @@
RTC_RUN_ON(worker_thread_checker_);
int GetRtpTimestampRateHz() const;
- int64_t GetRTT() const;
void OnReceivedPayloadData(rtc::ArrayView<const uint8_t> payload,
const RTPHeader& rtpHeader)
@@ -339,7 +338,8 @@
}
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<uint16_t> nack_list = acm_receiver_.GetNackList(round_trip_time);
if (!nack_list.empty()) {
@@ -725,7 +725,9 @@
// 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 @@
: acm_receiver_.last_output_sample_rate_hz();
}
-int64_t ChannelReceive::GetRTT() const {
- RTC_DCHECK_RUN_ON(&network_thread_checker_);
- std::vector<ReportBlockData> 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<ChannelReceiveInterface> CreateChannelReceive(