[Live-devel] RTCP bug in multicast?
Mark
hustmark at gmail.com
Sun Apr 24 23:10:08 PDT 2011
Hi Ross,
I just read the rtcp.cpp and find a problem in multicast mode.
In RTCPInstance::incomingReportHandler1(), from line 342 :
// Ignore the packet if it was looped-back from ourself:
if (RTCPgs()->wasLoopedBackFromUs(envir(), fromAddress)) {
// However, we still want to handle incoming RTCP packets from
// *other processes* on the same machine. To distinguish this
// case from a true loop-back, check whether we've just sent a
// packet of the same size. (This check isn't perfect, but it seems
// to be the best we can do.)
if (fHaveJustSentPacket && fLastPacketSentSize == packetSize) {
// This is a true loop-back:
fHaveJustSentPacket = False;
break; // ignore this packet
}
}
Here, the mechanism to prevent endless loop seems not perfect,
checking the variables fHaveJustSentPacket and fLastPacketSentSize is
not enough.
Think about this situation:
1. client1 sends out an RR(receive report)
2. server receives the RR and run into
RTCPInstance::incomingReportHandler1()
3. before server runs to line 364 of rtcp.cpp (
fRTCPInterface.sendPacket(pkt, packetSize); ) , client2 sends out an
RR packet
4. now server runs line 364-366; resending the client1's RR
packet to the multicast group, then modify fHaveJustSentPacket and
fLastPacketSentSize;
fRTCPInterface.sendPacket(pkt, packetSize);
fHaveJustSentPacket = True;
fLastPacketSentSize = packetSize;
5. in the next SingleStep(), the RTCP will receive the client2's
RR packet and resending the packet( line 364-366 of rtcp.cpp) to the
multicast group
6. in the next SingleStep(), the RR packet in step 4 is arrived and
server runs into RTCPInstance::incomingReportHandler1(), when it check
looped-back packet in line 342,
the variables fHaveJustSentPacket and fLastPacketSentSize are
modified in step 5, so the checking is incorrect and may cause endless
loop of multicast RTCP packet sending
To avoid this bug we must enable the code in
Groupsock::multicastSendOnly(), so the server will not received any
multicast packets that it just sent out.
More information about the live-devel
mailing list