Skip to content

Commit

Permalink
Transport: remove duplicate call to method (#931)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jmillan authored Oct 27, 2022
1 parent c1f0ce2 commit 397e216
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

### NEXT

* Transport: Remove duplicate call to method (PR #931).


### 3.10.12

Expand Down
22 changes: 14 additions & 8 deletions worker/src/RTC/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 397e216

Please sign in to comment.