OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Ami GONE FROM CHROMIUM
2013/06/13 20:56:47
lolwat2
| |
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> |
11 #include <sys/ioctl.h> | 11 #include <sys/ioctl.h> |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1283 if (!SetDevicePollInterrupt()) | 1283 if (!SetDevicePollInterrupt()) |
1284 return; | 1284 return; |
1285 // Start VIDIOC_STREAMON if we haven't yet. | 1285 // Start VIDIOC_STREAMON if we haven't yet. |
1286 if (!gsc_input_streamon_) { | 1286 if (!gsc_input_streamon_) { |
1287 __u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | 1287 __u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
1288 IOCTL_OR_ERROR_RETURN(gsc_fd_, VIDIOC_STREAMON, &type); | 1288 IOCTL_OR_ERROR_RETURN(gsc_fd_, VIDIOC_STREAMON, &type); |
1289 gsc_input_streamon_ = true; | 1289 gsc_input_streamon_ = true; |
1290 } | 1290 } |
1291 } | 1291 } |
1292 | 1292 |
1293 // Enqueue a GSC output, only if we need one | |
1294 // TODO(ihf): Revert to size > 0 once issue 225563 is fixed. | |
1295 COMPILE_ASSERT( | |
1296 kDpbOutputBufferExtraCount >= kGscOutputBufferExtraForSyncCount, | |
1297 gsc_output_buffer_extra_for_sync_count_too_large); | |
1298 if (gsc_input_buffer_queued_count_ != 0 && | 1293 if (gsc_input_buffer_queued_count_ != 0 && |
1299 gsc_output_buffer_queued_count_ == 0 && | 1294 gsc_output_buffer_queued_count_ == 0 && |
1300 gsc_free_output_buffers_.size() > kGscOutputBufferExtraForSyncCount) { | 1295 !gsc_free_output_buffers_.empty()) { |
1301 const int old_gsc_outputs_queued = gsc_output_buffer_queued_count_; | 1296 const int old_gsc_outputs_queued = gsc_output_buffer_queued_count_; |
1302 if (!EnqueueGscOutputRecord()) | 1297 if (!EnqueueGscOutputRecord()) |
1303 return; | 1298 return; |
1304 if (old_gsc_outputs_queued == 0 && gsc_output_buffer_queued_count_ != 0) { | 1299 if (old_gsc_outputs_queued == 0 && gsc_output_buffer_queued_count_ != 0) { |
1305 // We just started up a previously empty queue. | 1300 // We just started up a previously empty queue. |
1306 // Queue state changed; signal interrupt. | 1301 // Queue state changed; signal interrupt. |
1307 if (!SetDevicePollInterrupt()) | 1302 if (!SetDevicePollInterrupt()) |
1308 return; | 1303 return; |
1309 // Start VIDIOC_STREAMON if we haven't yet. | 1304 // Start VIDIOC_STREAMON if we haven't yet. |
1310 if (!gsc_output_streamon_) { | 1305 if (!gsc_output_streamon_) { |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2234 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 2229 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
2235 reqbufs.memory = V4L2_MEMORY_DMABUF; | 2230 reqbufs.memory = V4L2_MEMORY_DMABUF; |
2236 if (ioctl(gsc_fd_, VIDIOC_REQBUFS, &reqbufs) != 0) | 2231 if (ioctl(gsc_fd_, VIDIOC_REQBUFS, &reqbufs) != 0) |
2237 DPLOG(ERROR) << "DestroyGscOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS"; | 2232 DPLOG(ERROR) << "DestroyGscOutputBuffers(): ioctl() failed: VIDIOC_REQBUFS"; |
2238 | 2233 |
2239 gsc_output_buffer_map_.clear(); | 2234 gsc_output_buffer_map_.clear(); |
2240 gsc_free_output_buffers_.clear(); | 2235 gsc_free_output_buffers_.clear(); |
2241 } | 2236 } |
2242 | 2237 |
2243 } // namespace content | 2238 } // namespace content |
OLD | NEW |