From a28a91d2f00480c998112ceb47fa2ddca1a642c4 Mon Sep 17 00:00:00 2001 From: "pbos@webrtc.org" Date: Tue, 17 Feb 2015 14:45:08 +0000 Subject: [PATCH] Fix data race for RTCPReceiver stats callback. Annotates the callback which identifies the bug, then fixes it. R=stefan@webrtc.org BUG= Review URL: https://webrtc-codereview.appspot.com/40009004 Cr-Commit-Position: refs/heads/master@{#8390} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8390 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc | 1 + webrtc/modules/rtp_rtcp/source/rtcp_receiver.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc index 25a4756e6b..62d6676f0c 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -770,6 +770,7 @@ void RTCPReceiver::HandleSDESChunk(RTCPUtility::RTCPParserV2& rtcpParser) { cnameInfo->name[RTCP_CNAME_SIZE - 1] = 0; strncpy(cnameInfo->name, rtcpPacket.CName.CName, RTCP_CNAME_SIZE - 1); + CriticalSectionScoped lock(_criticalSectionFeedbacks); if (stats_callback_ != NULL) { stats_callback_->CNameChanged(rtcpPacket.CName.CName, rtcpPacket.CName.SenderSSRC); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h index a52e8101d6..46d10f754a 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h @@ -274,7 +274,7 @@ protected: // delivered RTP packet to the remote side. int64_t _lastIncreasedSequenceNumberMs; - RtcpStatisticsCallback* stats_callback_; + RtcpStatisticsCallback* stats_callback_ GUARDED_BY(_criticalSectionFeedbacks); RtcpPacketTypeCounter packet_type_counter_;