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}
This commit is contained in:
Alessio Bazzica 2022-09-08 16:41:08 +02:00 committed by WebRTC LUCI CQ
parent 137f1e681e
commit 53e5e282d0

View File

@ -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<const uint8_t> 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<uint16_t> 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<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(