| 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 <dlfcn.h> | 5 #include <dlfcn.h> |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
| 9 #include <poll.h> | 9 #include <poll.h> |
| 10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 return; | 1278 return; |
| 1279 // Start VIDIOC_STREAMON if we haven't yet. | 1279 // Start VIDIOC_STREAMON if we haven't yet. |
| 1280 if (!gsc_input_streamon_) { | 1280 if (!gsc_input_streamon_) { |
| 1281 __u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | 1281 __u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
| 1282 IOCTL_OR_ERROR_RETURN(gsc_fd_, VIDIOC_STREAMON, &type); | 1282 IOCTL_OR_ERROR_RETURN(gsc_fd_, VIDIOC_STREAMON, &type); |
| 1283 gsc_input_streamon_ = true; | 1283 gsc_input_streamon_ = true; |
| 1284 } | 1284 } |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 // Enqueue a GSC output, only if we need one | 1287 // Enqueue a GSC output, only if we need one |
| 1288 // TODO(ihf): Revert to size > 0 once issue 225563 is fixed. |
| 1288 if (gsc_input_buffer_queued_count_ != 0 && | 1289 if (gsc_input_buffer_queued_count_ != 0 && |
| 1289 gsc_output_buffer_queued_count_ == 0 && | 1290 gsc_output_buffer_queued_count_ == 0 && |
| 1290 !gsc_free_output_buffers_.empty()) { | 1291 gsc_free_output_buffers_.size() > 2) { |
| 1291 const int old_gsc_outputs_queued = gsc_output_buffer_queued_count_; | 1292 const int old_gsc_outputs_queued = gsc_output_buffer_queued_count_; |
| 1292 if (!EnqueueGscOutputRecord()) | 1293 if (!EnqueueGscOutputRecord()) |
| 1293 return; | 1294 return; |
| 1294 if (old_gsc_outputs_queued == 0 && gsc_output_buffer_queued_count_ != 0) { | 1295 if (old_gsc_outputs_queued == 0 && gsc_output_buffer_queued_count_ != 0) { |
| 1295 // We just started up a previously empty queue. | 1296 // We just started up a previously empty queue. |
| 1296 // Queue state changed; signal interrupt. | 1297 // Queue state changed; signal interrupt. |
| 1297 if (!SetDevicePollInterrupt()) | 1298 if (!SetDevicePollInterrupt()) |
| 1298 return; | 1299 return; |
| 1299 // Start VIDIOC_STREAMON if we haven't yet. | 1300 // Start VIDIOC_STREAMON if we haven't yet. |
| 1300 if (!gsc_output_streamon_) { | 1301 if (!gsc_output_streamon_) { |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 2212 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| 2212 reqbufs.memory = V4L2_MEMORY_DMABUF; | 2213 reqbufs.memory = V4L2_MEMORY_DMABUF; |
| 2213 if (ioctl(gsc_fd_, VIDIOC_REQBUFS, &reqbufs) != 0) | 2214 if (ioctl(gsc_fd_, VIDIOC_REQBUFS, &reqbufs) != 0) |
| 2214 DPLOG(ERROR) << "DestroyGscOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS"; | 2215 DPLOG(ERROR) << "DestroyGscOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS"; |
| 2215 | 2216 |
| 2216 gsc_output_buffer_map_.clear(); | 2217 gsc_output_buffer_map_.clear(); |
| 2217 gsc_free_output_buffers_.clear(); | 2218 gsc_free_output_buffers_.clear(); |
| 2218 } | 2219 } |
| 2219 | 2220 |
| 2220 } // namespace content | 2221 } // namespace content |
| OLD | NEW |