From 397e216af4762663c52b325c127692d21fc9dfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Thu, 27 Oct 2022 10:22:41 +0200 Subject: [PATCH] Transport: remove duplicate call to method (#931) * Transport: remove duplicate call to method We were calling twice Producer->GetRtcp() and Consumer->GetRtcp(). Those calls were not having any effect because the above methods just return if they are called before than expected, so the second call had no effect. --- CHANGELOG.md | 2 ++ worker/src/RTC/Transport.cpp | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9a5e4282..c7c9637cf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ### NEXT +* Transport: Remove duplicate call to method (PR #931). + ### 3.10.12 diff --git a/worker/src/RTC/Transport.cpp b/worker/src/RTC/Transport.cpp index ae9d277173..a9a68fa24c 100644 --- a/worker/src/RTC/Transport.cpp +++ b/worker/src/RTC/Transport.cpp @@ -2241,33 +2241,39 @@ namespace RTC for (auto& kv : this->mapConsumers) { auto* consumer = kv.second; + auto rtcpAdded = consumer->GetRtcp(packet.get(), nowMs); - // Send the RTCP compound packet if it's full. - if (!consumer->GetRtcp(packet.get(), nowMs)) + // RTCP data couldn't be added because the Compound packet is full. + // Send the RTCP compound packet and request for RTCP again. + if (!rtcpAdded) { SendRtcpCompoundPacket(packet.get()); // Create a new compount packet. packet.reset(new RTC::RTCP::CompoundPacket()); - } - consumer->GetRtcp(packet.get(), nowMs); + // Retrieve the RTCP again. + consumer->GetRtcp(packet.get(), nowMs); + } } for (auto& kv : this->mapProducers) { auto* producer = kv.second; + auto rtcpAdded = producer->GetRtcp(packet.get(), nowMs); - // Send the RTCP compound packet if it's full. - if (!producer->GetRtcp(packet.get(), nowMs)) + // RTCP data couldn't be added because the Compound packet is full. + // Send the RTCP compound packet and request for RTCP again. + if (!rtcpAdded) { SendRtcpCompoundPacket(packet.get()); // Create a new compount packet. packet.reset(new RTC::RTCP::CompoundPacket()); - } - producer->GetRtcp(packet.get(), nowMs); + // Retrieve the RTCP again. + producer->GetRtcp(packet.get(), nowMs); + } } // Send the RTCP compound packet if there is any sender or receiver report.