From 7845d07bf8baf6604543952cab7c084e97f3fe7f Mon Sep 17 00:00:00 2001 From: "mflodman@webrtc.org" Date: Thu, 8 Mar 2012 08:09:17 +0000 Subject: [PATCH] VideoCapture now uses pointer constructor of CriticalSectionScoped. BUG=184 TEST=video_capture_module compiles on all platforms when removing ref ctor of CriticalSectionScoped. Review URL: https://webrtc-codereview.appspot.com/434001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1855 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../source/Android/video_capture_android.cc | 10 ++-- .../main/source/Linux/video_capture_linux.cc | 4 +- .../source/Mac/QTKit/video_capture_qtkit.mm | 2 +- .../source/Windows/video_capture_windows.cc | 4 +- .../main/source/video_capture_impl.cc | 46 +++++++++---------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/modules/video_capture/main/source/Android/video_capture_android.cc b/src/modules/video_capture/main/source/Android/video_capture_android.cc index 4626108793..7694716df7 100644 --- a/src/modules/video_capture/main/source/Android/video_capture_android.cc +++ b/src/modules/video_capture/main/source/Android/video_capture_android.cc @@ -475,7 +475,7 @@ VideoCaptureAndroid::~VideoCaptureAndroid() WebRtc_Word32 VideoCaptureAndroid::StartCapture( const VideoCaptureCapability& capability) { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, -1, "%s: ", __FUNCTION__); @@ -552,7 +552,7 @@ WebRtc_Word32 VideoCaptureAndroid::StartCapture( } WebRtc_Word32 VideoCaptureAndroid::StopCapture() { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, -1, "%s: ", __FUNCTION__); @@ -613,7 +613,7 @@ WebRtc_Word32 VideoCaptureAndroid::StopCapture() bool VideoCaptureAndroid::CaptureStarted() { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, -1, "%s: ", __FUNCTION__); return _captureStarted; @@ -621,7 +621,7 @@ bool VideoCaptureAndroid::CaptureStarted() WebRtc_Word32 VideoCaptureAndroid::CaptureSettings( VideoCaptureCapability& settings) { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, -1, "%s: ", __FUNCTION__); settings = _requestedCapability; @@ -631,7 +631,7 @@ WebRtc_Word32 VideoCaptureAndroid::CaptureSettings( WebRtc_Word32 VideoCaptureAndroid::SetCaptureRotation( VideoCaptureRotation rotation) { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); if (VideoCaptureImpl::SetCaptureRotation(rotation) == 0) { if (!g_jvm) diff --git a/src/modules/video_capture/main/source/Linux/video_capture_linux.cc b/src/modules/video_capture/main/source/Linux/video_capture_linux.cc index d453894c63..2c690e9033 100644 --- a/src/modules/video_capture/main/source/Linux/video_capture_linux.cc +++ b/src/modules/video_capture/main/source/Linux/video_capture_linux.cc @@ -138,7 +138,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture( } } - CriticalSectionScoped cs(*_captureCritSect); + CriticalSectionScoped cs(_captureCritSect); //first open /dev/video device char device[20]; sprintf(device, "/dev/video%d", (int) _deviceId); @@ -254,7 +254,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StopCapture() _captureThread->SetNotAlive();// Make sure the capture thread stop stop using the critsect. - CriticalSectionScoped cs(*_captureCritSect); + CriticalSectionScoped cs(_captureCritSect); WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, -1, "StopCapture(), was running: %d", _captureStarted); diff --git a/src/modules/video_capture/main/source/Mac/QTKit/video_capture_qtkit.mm b/src/modules/video_capture/main/source/Mac/QTKit/video_capture_qtkit.mm index 91e983d7e4..8773b63795 100644 --- a/src/modules/video_capture/main/source/Mac/QTKit/video_capture_qtkit.mm +++ b/src/modules/video_capture/main/source/Mac/QTKit/video_capture_qtkit.mm @@ -58,7 +58,7 @@ VideoCaptureMacQTKit::~VideoCaptureMacQTKit() WebRtc_Word32 VideoCaptureMacQTKit::Init( const WebRtc_Word32 id, const char* iDeviceUniqueIdUTF8) { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); const WebRtc_Word32 nameLength = diff --git a/src/modules/video_capture/main/source/Windows/video_capture_windows.cc b/src/modules/video_capture/main/source/Windows/video_capture_windows.cc index 64091a4139..20ebe98f6b 100644 --- a/src/modules/video_capture/main/source/Windows/video_capture_windows.cc +++ b/src/modules/video_capture/main/source/Windows/video_capture_windows.cc @@ -155,7 +155,7 @@ WebRtc_Word32 VideoCaptureDS::Init(const WebRtc_Word32 id, WebRtc_Word32 VideoCaptureDS::StartCapture( const VideoCaptureCapability& capability) { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); if (capability != _requestedCapability) { @@ -178,7 +178,7 @@ WebRtc_Word32 VideoCaptureDS::StartCapture( WebRtc_Word32 VideoCaptureDS::StopCapture() { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); HRESULT hr = _mediaControl->Pause(); if (FAILED(hr)) diff --git a/src/modules/video_capture/main/source/video_capture_impl.cc b/src/modules/video_capture/main/source/video_capture_impl.cc index 16a8fa1599..c8cfb552c0 100644 --- a/src/modules/video_capture/main/source/video_capture_impl.cc +++ b/src/modules/video_capture/main/source/video_capture_impl.cc @@ -71,7 +71,7 @@ WebRtc_Word32 VideoCaptureImpl::TimeUntilNextProcess() // Process any pending tasks such as timeouts WebRtc_Word32 VideoCaptureImpl::Process() { - CriticalSectionScoped cs(_callBackCs); + CriticalSectionScoped cs(&_callBackCs); const TickTime now = TickTime::Now(); _lastProcessTime = TickTime::Now(); @@ -165,8 +165,8 @@ VideoCaptureImpl::~VideoCaptureImpl() WebRtc_Word32 VideoCaptureImpl::RegisterCaptureDataCallback( VideoCaptureDataCallback& dataCallBack) { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); _dataCallBack = &dataCallBack; return 0; @@ -174,37 +174,37 @@ WebRtc_Word32 VideoCaptureImpl::RegisterCaptureDataCallback( WebRtc_Word32 VideoCaptureImpl::DeRegisterCaptureDataCallback() { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); _dataCallBack = NULL; return 0; } WebRtc_Word32 VideoCaptureImpl::RegisterCaptureCallback(VideoCaptureFeedBack& callBack) { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); _captureCallBack = &callBack; return 0; } WebRtc_Word32 VideoCaptureImpl::DeRegisterCaptureCallback() { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); _captureCallBack = NULL; return 0; } WebRtc_Word32 VideoCaptureImpl::SetCaptureDelay(WebRtc_Word32 delayMS) { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); _captureDelay = delayMS; return 0; } WebRtc_Word32 VideoCaptureImpl::CaptureDelay() { - CriticalSectionScoped cs(_apiCs); + CriticalSectionScoped cs(&_apiCs); return _setCaptureDelay; } @@ -259,7 +259,7 @@ WebRtc_Word32 VideoCaptureImpl::IncomingFrame( TickTime startProcessTime = TickTime::Now(); - CriticalSectionScoped cs(_callBackCs); + CriticalSectionScoped cs(&_callBackCs); const WebRtc_Word32 width = frameInfo.width; const WebRtc_Word32 height = frameInfo.height; @@ -335,7 +335,7 @@ WebRtc_Word32 VideoCaptureImpl::IncomingFrame( WebRtc_Word32 VideoCaptureImpl::IncomingFrameI420( const VideoFrameI420& video_frame, WebRtc_Word64 captureTime) { - CriticalSectionScoped cs(_callBackCs); + CriticalSectionScoped cs(&_callBackCs); // Allocate I420 buffer int frame_size = CalcBufferSize(kI420, @@ -388,8 +388,8 @@ WebRtc_Word32 VideoCaptureImpl::IncomingFrameI420( WebRtc_Word32 VideoCaptureImpl::SetCaptureRotation(VideoCaptureRotation rotation) { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); switch (rotation) { case kCameraRotate0: @@ -411,8 +411,8 @@ WebRtc_Word32 VideoCaptureImpl::SetCaptureRotation(VideoCaptureRotation rotation WebRtc_Word32 VideoCaptureImpl::StartSendImage(const VideoFrame& videoFrame, WebRtc_Word32 frameRate) { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); if (frameRate < 1 || frameRate > kMaxFrameRate) { WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, @@ -427,16 +427,16 @@ WebRtc_Word32 VideoCaptureImpl::StartSendImage(const VideoFrame& videoFrame, } WebRtc_Word32 VideoCaptureImpl::StopSendImage() { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); _startImageFrameIntervall = 0; return 0; } WebRtc_Word32 VideoCaptureImpl::EnableFrameRateCallback(const bool enable) { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); _frameRateCallBack = enable; if (enable) { @@ -447,8 +447,8 @@ WebRtc_Word32 VideoCaptureImpl::EnableFrameRateCallback(const bool enable) WebRtc_Word32 VideoCaptureImpl::EnableNoPictureAlarm(const bool enable) { - CriticalSectionScoped cs(_apiCs); - CriticalSectionScoped cs2(_callBackCs); + CriticalSectionScoped cs(&_apiCs); + CriticalSectionScoped cs2(&_callBackCs); _noPictureAlarmCallBack = enable; return 0; }