From 7dc751458e1d5a3576065763737480e5f3f5a15b Mon Sep 17 00:00:00 2001 From: "mallinath@webrtc.org" Date: Wed, 29 Jan 2014 00:56:02 +0000 Subject: Revert 5444 "Revert 5421 "Fix deadlock on register/unregister ob..." We reverted the r5421 to allow us roll webrtc to chrome without any modifications to libjingle. Since webrtc is rolled with r5444, we can add back the original CL and changes to libjingle will be upstreamed in the next roll. TBR=andresp@webrtc.org > Revert 5421 "Fix deadlock on register/unregister observer while ..." > > Failure to compile on Chromium Internal bots, because of API changes. > > http://chromegw.corp.google.com/i/internal.chromium.webrtc.fyi/builders/Mac/builds/2805/steps/compile/logs/stdio > > You need to follow the steps mentioned in > https://docs.google.com/a/google.com/document/d/1aHrmXECnu3-Jovc2-zYI267EaQCYz-IclYyBp9iA9Fc/edit that of a API changer. > > Since I will be rolling the libjingle this week, I can push your changes along with libjingle roll, if you prepare the CLs > as mentioned in the doc. > > > Fix deadlock on register/unregister observer while there is a an going callback. > > > > BUG=2835 > > R=mallinath@webrtc.org > > > > Review URL: https://webrtc-codereview.appspot.com/7119005 > > TBR=andresp@webrtc.org > > Review URL: https://webrtc-codereview.appspot.com/7679004 TBR=mallinath@webrtc.org Review URL: https://webrtc-codereview.appspot.com/7729005 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5453 4adac7df-926f-26a2-2b94-8c16560cd09d --- video_engine/vie_capturer.cc | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'video_engine/vie_capturer.cc') diff --git a/video_engine/vie_capturer.cc b/video_engine/vie_capturer.cc index 6ec5653c..8b962777 100644 --- a/video_engine/vie_capturer.cc +++ b/video_engine/vie_capturer.cc @@ -279,7 +279,8 @@ void ViECapturer::CpuOveruseMeasures(int* capture_jitter_ms, } int32_t ViECapturer::SetCaptureDelay(int32_t delay_ms) { - return capture_module_->SetCaptureDelay(delay_ms); + capture_module_->SetCaptureDelay(delay_ms); + return 0; } int32_t ViECapturer::SetRotateCapturedFrames( @@ -638,29 +639,31 @@ bool ViECapturer::CaptureCapabilityFixed() { } int32_t ViECapturer::RegisterObserver(ViECaptureObserver* observer) { - CriticalSectionScoped cs(observer_cs_.get()); - if (observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s Observer already registered", __FUNCTION__, capture_id_); - return -1; - } - if (capture_module_->RegisterCaptureCallback(*this) != 0) { - return -1; + { + CriticalSectionScoped cs(observer_cs_.get()); + if (observer_) { + WEBRTC_TRACE(kTraceError, + kTraceVideo, + ViEId(engine_id_, capture_id_), + "%s Observer already registered", + __FUNCTION__, + capture_id_); + return -1; + } + observer_ = observer; } + capture_module_->RegisterCaptureCallback(*this); capture_module_->EnableFrameRateCallback(true); capture_module_->EnableNoPictureAlarm(true); - observer_ = observer; return 0; } int32_t ViECapturer::DeRegisterObserver() { - CriticalSectionScoped cs(observer_cs_.get()); - if (!observer_) { - return 0; - } capture_module_->EnableFrameRateCallback(false); capture_module_->EnableNoPictureAlarm(false); capture_module_->DeRegisterCaptureCallback(); + + CriticalSectionScoped cs(observer_cs_.get()); observer_ = NULL; return 0; } -- cgit v1.2.3