From cac7325b84a57ba4d1ab73e1ce58777a5946e4ba Mon Sep 17 00:00:00 2001 From: "mflodman@webrtc.org" Date: Tue, 3 Sep 2013 12:11:12 +0000 Subject: [PATCH] Adding critsect for child_modules_ in ModuleRtpRtcpImpl::Process() to avoid race with ModuleRtpRtcp::RegisterChildModule. Found with tsan. TEST=try job and tsan R=holmer@google.com Review URL: https://webrtc-codereview.appspot.com/2156004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4661 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 9360e098d..0922d2c92 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -196,7 +196,12 @@ int32_t ModuleRtpRtcpImpl::Process() { last_bitrate_process_time_ = now; } - const bool default_instance(child_modules_.empty() ? false : true); + bool default_instance = false; + { + CriticalSectionScoped cs(critical_section_module_ptrs_.get()); + if (!child_modules_.empty()) + default_instance = true; + } if (!default_instance) { if (rtcp_sender_.Sending()) { // Process RTT if we have received a receiver report and we haven't