OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/video/capture/linux/video_capture_device_linux.h" | 5 #include "media/video/capture/linux/video_capture_device_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #if defined(OS_OPENBSD) | 9 #if defined(OS_OPENBSD) |
10 #include <sys/videoio.h> | 10 #include <sys/videoio.h> |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // Max number of video buffers VideoCaptureDeviceLinux can allocate. | 28 // Max number of video buffers VideoCaptureDeviceLinux can allocate. |
29 enum { kMaxVideoBuffers = 2 }; | 29 enum { kMaxVideoBuffers = 2 }; |
30 // Timeout in microseconds v4l2_thread_ blocks waiting for a frame from the hw. | 30 // Timeout in microseconds v4l2_thread_ blocks waiting for a frame from the hw. |
31 enum { kCaptureTimeoutUs = 200000 }; | 31 enum { kCaptureTimeoutUs = 200000 }; |
32 // The number of continuous timeouts tolerated before treated as error. | 32 // The number of continuous timeouts tolerated before treated as error. |
33 enum { kContinuousTimeoutLimit = 10 }; | 33 enum { kContinuousTimeoutLimit = 10 }; |
34 // Time to wait in milliseconds before v4l2_thread_ reschedules OnCaptureTask | 34 // Time to wait in milliseconds before v4l2_thread_ reschedules OnCaptureTask |
35 // if an event is triggered (select) but no video frame is read. | 35 // if an event is triggered (select) but no video frame is read. |
36 enum { kCaptureSelectWaitMs = 10 }; | 36 enum { kCaptureSelectWaitMs = 10 }; |
37 // MJPEG is prefered if the width or height is larger than this. | 37 // MJPEG is preferred if the width or height is larger than this. |
38 enum { kMjpegWidth = 640 }; | 38 enum { kMjpegWidth = 640 }; |
39 enum { kMjpegHeight = 480 }; | 39 enum { kMjpegHeight = 480 }; |
40 // Typical framerate, in fps | 40 // Typical framerate, in fps |
41 enum { kTypicalFramerate = 30 }; | 41 enum { kTypicalFramerate = 30 }; |
42 | 42 |
43 // V4L2 color formats VideoCaptureDeviceLinux support. | 43 // V4L2 color formats VideoCaptureDeviceLinux support. |
44 static const int32 kV4l2RawFmts[] = { | 44 static const int32 kV4l2RawFmts[] = { |
45 V4L2_PIX_FMT_YUV420, | 45 V4L2_PIX_FMT_YUV420, |
46 V4L2_PIX_FMT_YUYV | 46 V4L2_PIX_FMT_YUYV |
47 }; | 47 }; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 502 |
503 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) { | 503 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) { |
504 DCHECK(!v4l2_thread_.IsRunning() || | 504 DCHECK(!v4l2_thread_.IsRunning() || |
505 v4l2_thread_.message_loop() == base::MessageLoop::current()); | 505 v4l2_thread_.message_loop() == base::MessageLoop::current()); |
506 DVLOG(1) << reason; | 506 DVLOG(1) << reason; |
507 state_ = kError; | 507 state_ = kError; |
508 client_->OnError(reason); | 508 client_->OnError(reason); |
509 } | 509 } |
510 | 510 |
511 } // namespace media | 511 } // namespace media |
OLD | NEW |