Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: webrtc/modules/video_capture/linux/video_capture_linux.cc

Issue 2790533002: Remove ALL usage of CriticalSectionWrapper. (Closed)
Patch Set: remove winXP rw_lock include Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_capture/linux/video_capture_linux.cc
diff --git a/webrtc/modules/video_capture/linux/video_capture_linux.cc b/webrtc/modules/video_capture/linux/video_capture_linux.cc
index d09c42a24f3235ee628f7883cec2106289e98e4e..c7c9f3e3d4d994d03d07b6edd7e9937666fa330a 100644
--- a/webrtc/modules/video_capture/linux/video_capture_linux.cc
+++ b/webrtc/modules/video_capture/linux/video_capture_linux.cc
@@ -24,7 +24,6 @@
#include "webrtc/base/refcount.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/video_capture/linux/video_capture_linux.h"
-#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/trace.h"
namespace webrtc {
@@ -42,7 +41,6 @@ rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
VideoCaptureModuleV4L2::VideoCaptureModuleV4L2()
: VideoCaptureImpl(),
- _captureCritSect(CriticalSectionWrapper::CreateCriticalSection()),
_deviceId(-1),
_deviceFd(-1),
_buffersAllocatedByDevice(-1),
@@ -107,10 +105,6 @@ int32_t VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8)
VideoCaptureModuleV4L2::~VideoCaptureModuleV4L2()
{
StopCapture();
- if (_captureCritSect)
- {
- delete _captureCritSect;
- }
if (_deviceFd != -1)
close(_deviceFd);
}
@@ -132,7 +126,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
}
}
- CriticalSectionScoped cs(_captureCritSect);
+ rtc::CritScope cs(&_captureCritSect);
//first open /dev/video device
char device[20];
sprintf(device, "/dev/video%d", (int) _deviceId);
@@ -303,7 +297,7 @@ int32_t VideoCaptureModuleV4L2::StopCapture()
_captureThread.reset();
}
- CriticalSectionScoped cs(_captureCritSect);
+ rtc::CritScope cs(&_captureCritSect);
if (_captureStarted)
{
_captureStarted = false;
@@ -410,7 +404,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
fd_set rSet;
struct timeval timeout;
- _captureCritSect->Enter();
+ rtc::CritScope cs(&_captureCritSect);
FD_ZERO(&rSet);
FD_SET(_deviceFd, &rSet);
@@ -421,19 +415,16 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
if (retVal < 0 && errno != EINTR) // continue if interrupted
{
// select failed
- _captureCritSect->Leave();
return false;
}
else if (retVal == 0)
{
// select timed out
- _captureCritSect->Leave();
return true;
}
else if (!FD_ISSET(_deviceFd, &rSet))
{
// not event on camera handle
- _captureCritSect->Leave();
return true;
}
@@ -450,7 +441,6 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
{
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"could not sync on a buffer on device %s", strerror(errno));
- _captureCritSect->Leave();
return true;
}
}
@@ -469,7 +459,6 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
"Failed to enqueue capture buffer");
}
}
- _captureCritSect->Leave();
usleep(0);
return true;
}
« no previous file with comments | « webrtc/modules/video_capture/linux/video_capture_linux.h ('k') | webrtc/modules/video_capture/test/video_capture_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698