From 963b979510f6521fd69576f146235c6a5c0f8264 Mon Sep 17 00:00:00 2001 From: "pbos@webrtc.org" Date: Tue, 7 Oct 2014 14:27:27 +0000 Subject: [PATCH] Remove potential deadlock in WebRtcVideoEngine2. Fixes lock-order inversions between capturer's SignalVideoFrame and WebRtcVideoSendStream. Additionally also removes all deadlock suppressions for WebRtcVideoEngine2. R=stefan@webrtc.org TBR=kjellander@webrtc.org BUG=1788,2999 Review URL: https://webrtc-codereview.appspot.com/26729004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7386 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/media/webrtc/webrtcvideoengine2.cc | 14 +++++++++----- webrtc/build/tsan_suppressions_webrtc.cc | 2 -- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc index 1d7c006c2..8b46f767a 100644 --- a/talk/media/webrtc/webrtcvideoengine2.cc +++ b/talk/media/webrtc/webrtcvideoengine2.cc @@ -1481,12 +1481,16 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::MuteStream(bool mute) { } bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() { - rtc::CritScope cs(&lock_); - if (capturer_ == NULL) { - return false; + cricket::VideoCapturer* capturer; + { + rtc::CritScope cs(&lock_); + if (capturer_ == NULL) { + return false; + } + capturer = capturer_; + capturer_ = NULL; } - capturer_->SignalVideoFrame.disconnect(this); - capturer_ = NULL; + capturer->SignalVideoFrame.disconnect(this); return true; } diff --git a/webrtc/build/tsan_suppressions_webrtc.cc b/webrtc/build/tsan_suppressions_webrtc.cc index 0ae74f1ff..548045b67 100644 --- a/webrtc/build/tsan_suppressions_webrtc.cc +++ b/webrtc/build/tsan_suppressions_webrtc.cc @@ -59,8 +59,6 @@ char kTSanDefaultSuppressions[] = // Potential deadlocks detected after roll in r6516. // https://code.google.com/p/webrtc/issues/detail?id=3509 -"deadlock:cricket::WebRtcVideoChannel2::WebRtcVideoSendStream::InputFrame\n" -"deadlock:cricket::WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer\n" "deadlock:webrtc::ProcessThreadImpl::RegisterModule\n" "deadlock:webrtc::RTCPReceiver::SetSsrcs\n" "deadlock:webrtc::RTPSenderAudio::RegisterAudioPayload\n"