| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/capture/video/linux/v4l2_capture_delegate.h" | 5 #include "device/capture/video/linux/v4l2_capture_delegate.h" |
| 6 | 6 |
| 7 #include <poll.h> | 7 #include <poll.h> |
| 8 #include <sys/fcntl.h> | 8 #include <sys/fcntl.h> |
| 9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
| 15 #include "base/posix/eintr_wrapper.h" | 15 #include "base/posix/eintr_wrapper.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "device/capture/video/linux/video_capture_device_linux.h" |
| 18 #include "media/base/bind_to_current_loop.h" | 19 #include "media/base/bind_to_current_loop.h" |
| 19 #include "media/capture/video/linux/video_capture_device_linux.h" | |
| 20 | 20 |
| 21 namespace media { | 21 namespace media { |
| 22 | 22 |
| 23 // Desired number of video buffers to allocate. The actual number of allocated | 23 // Desired number of video buffers to allocate. The actual number of allocated |
| 24 // buffers by v4l2 driver can be higher or lower than this number. | 24 // buffers by v4l2 driver can be higher or lower than this number. |
| 25 // kNumVideoBuffers should not be too small, or Chrome may not return enough | 25 // kNumVideoBuffers should not be too small, or Chrome may not return enough |
| 26 // buffers back to driver in time. | 26 // buffers back to driver in time. |
| 27 const uint32_t kNumVideoBuffers = 4; | 27 const uint32_t kNumVideoBuffers = 4; |
| 28 // Timeout in milliseconds v4l2_thread_ blocks waiting for a frame from the hw. | 28 // Timeout in milliseconds v4l2_thread_ blocks waiting for a frame from the hw. |
| 29 // This value has been fine tuned. Before changing or modifying it see | 29 // This value has been fine tuned. Before changing or modifying it see |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; | 437 DLOG(ERROR) << "Error mmap()ing a V4L2 buffer into userspace"; |
| 438 return false; | 438 return false; |
| 439 } | 439 } |
| 440 start_ = static_cast<uint8_t*>(start); | 440 start_ = static_cast<uint8_t*>(start); |
| 441 length_ = buffer.length; | 441 length_ = buffer.length; |
| 442 payload_size_ = 0; | 442 payload_size_ = 0; |
| 443 return true; | 443 return true; |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace media | 446 } // namespace media |
| OLD | NEW |