Index: media/capture/video/linux/v4l2_capture_delegate.cc |
diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc |
index de0e35b79f43cc3f4c0a8fefc74d8cfa09764b8a..b6442327419ce55d6c5a169478d8c2267d2db420 100644 |
--- a/media/capture/video/linux/v4l2_capture_delegate.cc |
+++ b/media/capture/video/linux/v4l2_capture_delegate.cc |
@@ -16,8 +16,18 @@ |
#include "base/strings/stringprintf.h" |
#include "build/build_config.h" |
#include "media/base/bind_to_current_loop.h" |
-#include "media/capture/video/blob_utils.h" |
#include "media/capture/video/linux/video_capture_device_linux.h" |
+#include "media/capture/video/video_capture_utils.h" |
+ |
+// TODO(astojilj): Remove V4L2_PIX_FMT_Z16/INVZ when videodev2.h gets updated. |
+#ifndef V4L2_PIX_FMT_Z16 |
+// 16 bit depth, Realsense F200. |
+#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') |
+#endif |
+#ifndef V4L2_PIX_FMT_INVZ |
+// 16 bit depth, Realsense SR300. |
+#define V4L2_PIX_FMT_INVZ v4l2_fourcc('I', 'N', 'V', 'Z') |
+#endif |
namespace media { |
@@ -50,6 +60,9 @@ static struct { |
size_t num_planes; |
} const kSupportedFormatsAndPlanarity[] = { |
{V4L2_PIX_FMT_YUV420, PIXEL_FORMAT_I420, 1}, |
+ {V4L2_PIX_FMT_Y16, PIXEL_FORMAT_Y16, 1}, |
+ {V4L2_PIX_FMT_Z16, PIXEL_FORMAT_Y16, 1}, |
+ {V4L2_PIX_FMT_INVZ, PIXEL_FORMAT_Y16, 1}, |
{V4L2_PIX_FMT_YUYV, PIXEL_FORMAT_YUY2, 1}, |
{V4L2_PIX_FMT_UYVY, PIXEL_FORMAT_UYVY, 1}, |
{V4L2_PIX_FMT_RGB24, PIXEL_FORMAT_RGB24, 1}, |
@@ -567,9 +580,16 @@ void V4L2CaptureDelegate::DoCapture() { |
base::TimeDelta timestamp = |
base::TimeDelta::FromSeconds(buffer.timestamp.tv_sec) + |
base::TimeDelta::FromMicroseconds(buffer.timestamp.tv_usec); |
- client_->OnIncomingCapturedData( |
- buffer_tracker->start(), buffer_tracker->payload_size(), |
- capture_format_, rotation_, base::TimeTicks::Now(), timestamp); |
+#ifdef V4L2_BUF_FLAG_ERROR |
+ if (buffer.flags & V4L2_BUF_FLAG_ERROR) { |
+ LOG(ERROR) << "Dequeued v4l2 buffer contains corrupted data (" |
+ << buffer.bytesused << " bytes)."; |
+ buffer.bytesused = 0; |
+ } else |
+#endif |
+ client_->OnIncomingCapturedData( |
+ buffer_tracker->start(), buffer_tracker->payload_size(), |
+ capture_format_, rotation_, base::TimeTicks::Now(), timestamp); |
while (!take_photo_callbacks_.empty()) { |
VideoCaptureDevice::TakePhotoCallback cb = |