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> |
11 #else | 11 #else |
12 #include <linux/videodev2.h> | 12 #include <linux/videodev2.h> |
13 #endif | 13 #endif |
14 #include <sys/ioctl.h> | 14 #include <sys/ioctl.h> |
15 #include <sys/mman.h> | 15 #include <sys/mman.h> |
16 | 16 |
17 #include <list> | 17 #include <list> |
18 #include <string> | 18 #include <string> |
19 | 19 |
20 #include "base/bind.h" | 20 #include "base/bind.h" |
21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
22 #include "base/files/file_enumerator.h" | 22 #include "base/files/file_enumerator.h" |
23 #include "base/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
24 | 24 |
25 namespace media { | 25 namespace media { |
26 | 26 |
27 // Max number of video buffers VideoCaptureDeviceLinux can allocate. | 27 // Max number of video buffers VideoCaptureDeviceLinux can allocate. |
28 enum { kMaxVideoBuffers = 2 }; | 28 enum { kMaxVideoBuffers = 2 }; |
29 // Timeout in microseconds v4l2_thread_ blocks waiting for a frame from the hw. | 29 // Timeout in microseconds v4l2_thread_ blocks waiting for a frame from the hw. |
30 enum { kCaptureTimeoutUs = 200000 }; | 30 enum { kCaptureTimeoutUs = 200000 }; |
31 // The number of continuous timeouts tolerated before treated as error. | 31 // The number of continuous timeouts tolerated before treated as error. |
32 enum { kContinuousTimeoutLimit = 10 }; | 32 enum { kContinuousTimeoutLimit = 10 }; |
33 // Time to wait in milliseconds before v4l2_thread_ reschedules OnCaptureTask | 33 // Time to wait in milliseconds before v4l2_thread_ reschedules OnCaptureTask |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 buffer_pool_size_ = 0; | 533 buffer_pool_size_ = 0; |
534 } | 534 } |
535 | 535 |
536 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) { | 536 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) { |
537 DVLOG(1) << reason; | 537 DVLOG(1) << reason; |
538 state_ = kError; | 538 state_ = kError; |
539 observer_->OnError(); | 539 observer_->OnError(); |
540 } | 540 } |
541 | 541 |
542 } // namespace media | 542 } // namespace media |
OLD | NEW |