Avoid acquiring VCM::_receiveCritSect during decode callback.

When VideoDecoder::Decode, Reset, or Release is called,
VideoCodingModuleImpl::_receiveCritSect may have been
acquired. Decode callback needs to acquire the same lock
in ViEChannel::FrameToRender. It is not a problem for
SW decode because decode callback is run on the same
WebRTC decoding thread and the lock is re-entrant. But
for HW decode, decode callback is run on a thread different
from WebRTC decoding thread. Decode callback gets the locks
in the opposite order. Deadlock can happen.

BUG=http://crbug.com/170345
TEST=Try apprtc.appspot.com/?debug=loopback on ARM Chromebook Daisy.
     Run libjingle_peerconnection_unittest.

R=stefan@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4523 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wuchengli@chromium.org
2013-08-12 14:20:49 +00:00
parent 9668467d87
commit 0d94c2f81c
6 changed files with 31 additions and 16 deletions

View File

@ -510,6 +510,8 @@ VCMGenericDecoder* VCMCodecDataBase::GetDecoder(
if (!ptr_decoder_) {
return NULL;
}
VCMReceiveCallback* callback = decoded_frame_callback->UserReceiveCallback();
if (callback) callback->IncomingCodecChanged(receive_codec_);
if (ptr_decoder_->RegisterDecodeCompleteCallback(decoded_frame_callback)
< 0) {
ReleaseDecoder(ptr_decoder_);