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

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

Issue 2534553002: Replace VideoCaptureDataCallback by VideoSinkInterface. (Closed)
Patch Set: Break overlong lines. Created 4 years 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 cee1355c0908f09227660ed1a844ef22bae13c7a..e8da74bb2f33c7228d262c241b9c887c6c66ec21 100644
--- a/webrtc/modules/video_capture/linux/video_capture_linux.cc
+++ b/webrtc/modules/video_capture/linux/video_capture_linux.cc
@@ -30,10 +30,9 @@
namespace webrtc {
namespace videocapturemodule {
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
- const int32_t id,
const char* deviceUniqueId) {
rtc::scoped_refptr<VideoCaptureModuleV4L2> implementation(
- new rtc::RefCountedObject<VideoCaptureModuleV4L2>(id));
+ new rtc::RefCountedObject<VideoCaptureModuleV4L2>());
if (implementation->Init(deviceUniqueId) != 0)
return nullptr;
@@ -41,8 +40,8 @@ rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
return implementation;
}
-VideoCaptureModuleV4L2::VideoCaptureModuleV4L2(const int32_t id)
- : VideoCaptureImpl(id),
+VideoCaptureModuleV4L2::VideoCaptureModuleV4L2()
+ : VideoCaptureImpl(),
_captureCritSect(CriticalSectionWrapper::CreateCriticalSection()),
_deviceId(-1),
_deviceFd(-1),
@@ -97,7 +96,8 @@ int32_t VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8)
}
if (!found)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, "no matching device found");
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture,
+ 0, "no matching device found");
return -1;
}
_deviceId = n; //store the device id
@@ -139,7 +139,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
if ((_deviceFd = open(device, O_RDWR | O_NONBLOCK, 0)) < 0)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"error in opening %s errono = %d", device, errno);
return -1;
}
@@ -169,10 +169,10 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
memset(&fmt, 0, sizeof(fmt));
fmt.index = 0;
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
"Video Capture enumerats supported image formats:");
while (ioctl(_deviceFd, VIDIOC_ENUM_FMT, &fmt) == 0) {
- WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
" { pixelformat = %c%c%c%c, description = '%s' }",
fmt.pixelformat & 0xFF, (fmt.pixelformat>>8) & 0xFF,
(fmt.pixelformat>>16) & 0xFF, (fmt.pixelformat>>24) & 0xFF,
@@ -188,11 +188,11 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
if (fmtsIdx == nFormats)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"no supporting video formats found");
return -1;
} else {
- WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
"We prefer format %c%c%c%c",
fmts[fmtsIdx] & 0xFF, (fmts[fmtsIdx]>>8) & 0xFF,
(fmts[fmtsIdx]>>16) & 0xFF, (fmts[fmtsIdx]>>24) & 0xFF);
@@ -219,7 +219,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
//set format and frame size now
if (ioctl(_deviceFd, VIDIOC_S_FMT, &video_fmt) < 0)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"error in VIDIOC_S_FMT, errno = %d", errno);
return -1;
}
@@ -235,7 +235,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
memset(&streamparms, 0, sizeof(streamparms));
streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"error in VIDIOC_G_PARM errno = %d", errno);
driver_framerate_support = false;
// continue
@@ -248,7 +248,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
streamparms.parm.capture.timeperframe.numerator = 1;
streamparms.parm.capture.timeperframe.denominator = capability.maxFPS;
if (ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"Failed to set the framerate. errno=%d", errno);
driver_framerate_support = false;
} else {
@@ -268,7 +268,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
if (!AllocateVideoBuffers())
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"failed to allocate video capture buffers");
return -1;
}
@@ -287,7 +287,7 @@ int32_t VideoCaptureModuleV4L2::StartCapture(
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(_deviceFd, VIDIOC_STREAMON, &type) == -1)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"Failed to turn on stream");
return -1;
}
@@ -330,7 +330,7 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers()
if (ioctl(_deviceFd, VIDIOC_REQBUFS, &rbuffer) < 0)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"Could not get buffers from device. errno = %d", errno);
return false;
}
@@ -389,7 +389,7 @@ bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers()
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(_deviceFd, VIDIOC_STREAMOFF, &type) < 0)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"VIDIOC_STREAMOFF error. errno: %d", errno);
}
@@ -449,7 +449,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
{
if (errno != EINTR)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0,
"could not sync on a buffer on device %s", strerror(errno));
_captureCritSect->Leave();
return true;
@@ -466,7 +466,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
// enqueue the buffer again
if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1)
{
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, 0,
"Failed to enqueue capture buffer");
}
}
« no previous file with comments | « webrtc/modules/video_capture/linux/video_capture_linux.h ('k') | webrtc/modules/video_capture/objc/device_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698