Bugfix issue 533. Client does not handle NACK or PLI requests received from far end if a RTCP report from it has not been processed when RFC 5506 is enabled.

Review URL: https://webrtc-codereview.appspot.com/569020

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2263 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2012-05-21 12:00:49 +00:00
parent 1bca6d2437
commit b2179c20f0
2 changed files with 45 additions and 91 deletions

View File

@ -721,14 +721,6 @@ RTCPReceiver::HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation) RTCPPacketInformation& rtcpPacketInformation)
{ {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(rtcpPacket.NACK.SenderSSRC);
if (ptrReceiveInfo == NULL)
{
// This remote SSRC must be saved before.
rtcpParser.Iterate();
return;
}
if (_SSRC != rtcpPacket.NACK.MediaSSRC) if (_SSRC != rtcpPacket.NACK.MediaSSRC)
{ {
// Not to us. // Not to us.
@ -846,26 +838,13 @@ RTCPReceiver::HandleXRVOIPMetric(RTCPUtility::RTCPParserV2& rtcpParser,
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandlePLI(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation)
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
if (_SSRC == rtcpPacket.PLI.MediaSSRC) {
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(rtcpPacket.PLI.SenderSSRC); // Received a signal that we need to send a new key frame.
if (ptrReceiveInfo == NULL) rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpPli;
{
// This remote SSRC must be saved before.
rtcpParser.Iterate();
return;
} }
if (_SSRC != rtcpPacket.PLI.MediaSSRC)
{
// Not to us.
rtcpParser.Iterate();
return;
}
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpPli; // received signal that we need to send a new key frame
rtcpParser.Iterate(); rtcpParser.Iterate();
} }
@ -990,15 +969,6 @@ RTCPReceiver::HandleSLI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation) RTCPPacketInformation& rtcpPacketInformation)
{ {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(rtcpPacket.SLI.SenderSSRC);
if (ptrReceiveInfo == NULL)
{
// This remote SSRC must be saved before.
rtcpParser.Iterate();
return;
}
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpPsfbSliItemCode) while (pktType == RTCPUtility::kRtcpPsfbSliItemCode)
{ {
@ -1022,14 +992,6 @@ RTCPReceiver::HandleRPSI(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation) RTCPHelp::RTCPPacketInformation& rtcpPacketInformation)
{ {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(rtcpPacket.RPSI.SenderSSRC);
if (ptrReceiveInfo == NULL)
{
// This remote SSRC must be saved before.
rtcpParser.Iterate();
return;
}
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
if(pktType == RTCPUtility::kRtcpPsfbRpsiCode) if(pktType == RTCPUtility::kRtcpPsfbRpsiCode)
{ {
@ -1101,54 +1063,46 @@ void RTCPReceiver::HandleREMBItem(
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPReceiver::HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser, RTCPPacketInformation& rtcpPacketInformation) {
RTCPPacketInformation& rtcpPacketInformation)
{
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet(); const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
RTCPReceiveInformation* ptrReceiveInfo =
RTCPReceiveInformation* ptrReceiveInfo = GetReceiveInformation(rtcpPacket.FIR.SenderSSRC); GetReceiveInformation(rtcpPacket.FIR.SenderSSRC);
if (ptrReceiveInfo == NULL)
{
// This remote SSRC must be saved before.
rtcpParser.Iterate();
return;
}
RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate(); RTCPUtility::RTCPPacketTypes pktType = rtcpParser.Iterate();
while (pktType == RTCPUtility::kRtcpPsfbFirItemCode) while (pktType == RTCPUtility::kRtcpPsfbFirItemCode) {
{ HandleFIRItem(ptrReceiveInfo, rtcpPacket, rtcpPacketInformation);
HandleFIRItem(*ptrReceiveInfo, rtcpPacket, rtcpPacketInformation);
pktType = rtcpParser.Iterate(); pktType = rtcpParser.Iterate();
} }
} }
// no need for critsect we have _criticalSectionRTCPReceiver // no need for critsect we have _criticalSectionRTCPReceiver
void void RTCPReceiver::HandleFIRItem(RTCPReceiveInformation* receiveInfo,
RTCPReceiver::HandleFIRItem(RTCPReceiveInformation& receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket, const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPPacketInformation& rtcpPacketInformation) RTCPPacketInformation& rtcpPacketInformation) {
{ // Is it our sender that is requested to generate a new keyframe
if (_SSRC == rtcpPacket.FIRItem.SSRC) // is it our sender that is requested to generate a new keyframe if (_SSRC != rtcpPacket.FIRItem.SSRC) {
{ return;
}
// rtcpPacket.FIR.MediaSSRC SHOULD be 0 but we ignore to check it // rtcpPacket.FIR.MediaSSRC SHOULD be 0 but we ignore to check it
// we don't know who this originate from // we don't know who this originate from
if (receiveInfo) {
// check if we have reported this FIRSequenceNumber before // check if we have reported this FIRSequenceNumber before
if (rtcpPacket.FIRItem.CommandSequenceNumber != receiveInfo.lastFIRSequenceNumber) if (rtcpPacket.FIRItem.CommandSequenceNumber !=
{ receiveInfo->lastFIRSequenceNumber) {
//
WebRtc_UWord32 now = _clock.GetTimeInMS(); WebRtc_UWord32 now = _clock.GetTimeInMS();
// sanity; don't go crazy with the callbacks
// extra sanity don't go crazy with the callbacks if ((now - receiveInfo->lastFIRRequest) > RTCP_MIN_FRAME_LENGTH_MS) {
if( (now - receiveInfo.lastFIRRequest) > RTCP_MIN_FRAME_LENGTH_MS) receiveInfo->lastFIRRequest = now;
{ receiveInfo->lastFIRSequenceNumber =
receiveInfo.lastFIRRequest = now; rtcpPacket.FIRItem.CommandSequenceNumber;
receiveInfo.lastFIRSequenceNumber = rtcpPacket.FIRItem.CommandSequenceNumber; // received signal that we need to send a new key frame
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpFir;
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpFir; // received signal that we need to send a new key frame
} }
} }
} else {
// received signal that we need to send a new key frame
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpFir;
} }
} }

View File

@ -175,7 +175,7 @@ protected:
void HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser, void HandleFIR(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);
void HandleFIRItem(RTCPHelp::RTCPReceiveInformation& receiveInfo, void HandleFIRItem(RTCPHelp::RTCPReceiveInformation* receiveInfo,
const RTCPUtility::RTCPPacket& rtcpPacket, const RTCPUtility::RTCPPacket& rtcpPacket,
RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); RTCPHelp::RTCPPacketInformation& rtcpPacketInformation);