diff --git a/src/modules/rtp_rtcp/source/rtcp_sender.cc b/src/modules/rtp_rtcp/source/rtcp_sender.cc index 7e6f385369..0a01048ef1 100644 --- a/src/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/src/modules/rtp_rtcp/source/rtcp_sender.cc @@ -457,15 +457,15 @@ From RFC 3550 a value of the RTCP bandwidth below the intended average */ + WebRtc_UWord32 now = ModuleRTPUtility::GetTimeInMS(); + + CriticalSectionScoped lock(_criticalSectionRTCPSender); + if(_method == kRtcpOff) { return false; } - WebRtc_UWord32 now = ModuleRTPUtility::GetTimeInMS(); - - CriticalSectionScoped lock(_criticalSectionRTCPSender); - if(!_audio && sendKeyframeBeforeRTP) { // for video key-frames we want to send the RTCP before the large key-frame @@ -1564,11 +1564,6 @@ RTCPSender::SendRTCP(const WebRtc_UWord32 packetTypeFlags, WebRtc_UWord32 pos = 0; WebRtc_UWord8 rtcpbuffer[IP_PACKET_SIZE]; - if(_method == kRtcpOff) - { - WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id, "%s invalid state", __FUNCTION__); - return -1; - } do // only to be able to use break :) (and the critsect must be inside its own scope) { @@ -1577,8 +1572,20 @@ RTCPSender::SendRTCP(const WebRtc_UWord32 packetTypeFlags, bool hasReceived = false; WebRtc_UWord32 NTPsec = 0; WebRtc_UWord32 NTPfrac = 0; + bool rtcpCompound = false; - if( _method == kRtcpCompound || + { + CriticalSectionScoped lock(_criticalSectionRTCPSender); + if(_method == kRtcpOff) + { + WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, _id, + "%s invalid state", __FUNCTION__); + return -1; + } + rtcpCompound = (_method == kRtcpCompound) ? true : false; + } + + if (rtcpCompound || rtcpPacketTypeFlags & kRtcpReport || rtcpPacketTypeFlags & kRtcpSr || rtcpPacketTypeFlags & kRtcpRr) diff --git a/src/modules/rtp_rtcp/source/rtp_receiver.cc b/src/modules/rtp_rtcp/source/rtp_receiver.cc index f3c8d98126..146caad011 100644 --- a/src/modules/rtp_rtcp/source/rtp_receiver.cc +++ b/src/modules/rtp_rtcp/source/rtp_receiver.cc @@ -236,15 +236,15 @@ RTPReceiver::SetPacketTimeout(const WebRtc_UWord32 timeoutMS) void RTPReceiver::PacketTimeout() { - if(_packetTimeOutMS == 0) - { - // not configured - return; - } - bool packetTimeOut = false; { CriticalSectionScoped lock(_criticalSectionRTPReceiver); + if(_packetTimeOutMS == 0) + { + // not configured + return; + } + if(_lastReceiveTime == 0) { // not active