| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <linux/videodev2.h> | 7 #include <linux/videodev2.h> |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 for (size_t i = 0; i < input_planes_count_; ++i) { | 661 for (size_t i = 0; i < input_planes_count_; ++i) { |
| 662 qbuf.m.planes[i].bytesused = | 662 qbuf.m.planes[i].bytesused = |
| 663 VideoFrame::PlaneSize(input_record.frame->format(), i, | 663 VideoFrame::PlaneSize(input_record.frame->format(), i, |
| 664 input_allocated_size_) | 664 input_allocated_size_) |
| 665 .GetArea(); | 665 .GetArea(); |
| 666 qbuf.m.planes[i].length = qbuf.m.planes[i].bytesused; | 666 qbuf.m.planes[i].length = qbuf.m.planes[i].bytesused; |
| 667 if (input_memory_type_ == V4L2_MEMORY_USERPTR) { | 667 if (input_memory_type_ == V4L2_MEMORY_USERPTR) { |
| 668 qbuf.m.planes[i].m.userptr = | 668 qbuf.m.planes[i].m.userptr = |
| 669 reinterpret_cast<unsigned long>(input_record.frame->data(i)); | 669 reinterpret_cast<unsigned long>(input_record.frame->data(i)); |
| 670 } else { | 670 } else { |
| 671 qbuf.m.planes[i].m.fd = input_record.frame->dmabuf_fd(i); | 671 qbuf.m.planes[i].m.fd = input_record.frame->DmabufFd(i); |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QBUF, &qbuf); | 674 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QBUF, &qbuf); |
| 675 input_record.at_device = true; | 675 input_record.at_device = true; |
| 676 running_jobs_.push(job_record); | 676 running_jobs_.push(job_record); |
| 677 free_input_buffers_.pop_back(); | 677 free_input_buffers_.pop_back(); |
| 678 input_buffer_queued_count_++; | 678 input_buffer_queued_count_++; |
| 679 | 679 |
| 680 DVLOG(3) << __func__ << ": enqueued frame ts=" | 680 DVLOG(3) << __func__ << ": enqueued frame ts=" |
| 681 << job_record->frame->timestamp().InMilliseconds() << " to device."; | 681 << job_record->frame->timestamp().InMilliseconds() << " to device."; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 output_buffer_queued_count_ = 0; | 777 output_buffer_queued_count_ = 0; |
| 778 } | 778 } |
| 779 | 779 |
| 780 void V4L2ImageProcessor::FrameReady(const FrameReadyCB& cb, | 780 void V4L2ImageProcessor::FrameReady(const FrameReadyCB& cb, |
| 781 int output_buffer_index) { | 781 int output_buffer_index) { |
| 782 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 782 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 783 cb.Run(output_buffer_index); | 783 cb.Run(output_buffer_index); |
| 784 } | 784 } |
| 785 | 785 |
| 786 } // namespace media | 786 } // namespace media |
| OLD | NEW |