summaryrefslogtreecommitdiff
path: root/video_engine/vie_capturer.cc
diff options
context:
space:
mode:
authormallinath@webrtc.org <mallinath@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-01-29 00:56:02 +0000
committermallinath@webrtc.org <mallinath@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-01-29 00:56:02 +0000
commit7dc751458e1d5a3576065763737480e5f3f5a15b (patch)
tree40c9495c795b18446452b6753a8004d6f2d47362 /video_engine/vie_capturer.cc
parenta6b9a3fc191d1647bea7227f3228987a580071f6 (diff)
downloadwebrtc-7dc751458e1d5a3576065763737480e5f3f5a15b.tar.gz
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
Diffstat (limited to 'video_engine/vie_capturer.cc')
-rw-r--r--video_engine/vie_capturer.cc31
1 files changed, 17 insertions, 14 deletions
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;
}