| 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 "media/gpu/v4l2_video_encode_accelerator.h" | 5 #include "media/gpu/v4l2_video_encode_accelerator.h" |
| 6 | 6 |
| 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 <string.h> | 10 #include <string.h> |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 bool V4L2VideoEncodeAccelerator::CreateInputBuffers() { | 1137 bool V4L2VideoEncodeAccelerator::CreateInputBuffers() { |
| 1138 DVLOG(3) << "CreateInputBuffers()"; | 1138 DVLOG(3) << "CreateInputBuffers()"; |
| 1139 // This function runs on encoder_thread_ after output buffers have been | 1139 // This function runs on encoder_thread_ after output buffers have been |
| 1140 // provided by the client. | 1140 // provided by the client. |
| 1141 DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread()); | 1141 DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread()); |
| 1142 DCHECK(!input_streamon_); | 1142 DCHECK(!input_streamon_); |
| 1143 | 1143 |
| 1144 struct v4l2_requestbuffers reqbufs; | 1144 struct v4l2_requestbuffers reqbufs; |
| 1145 memset(&reqbufs, 0, sizeof(reqbufs)); | 1145 memset(&reqbufs, 0, sizeof(reqbufs)); |
| 1146 // Driver will modify to the appropriate number of buffers. | 1146 // Driver will modify to the appropriate number of buffers. |
| 1147 reqbufs.count = 1; | 1147 reqbufs.count = kInputBufferCount; |
| 1148 reqbufs.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; | 1148 reqbufs.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; |
| 1149 // TODO(posciak): Once we start doing zero-copy, we should decide based on | 1149 // TODO(posciak): Once we start doing zero-copy, we should decide based on |
| 1150 // the current pipeline setup which memory type to use. This should probably | 1150 // the current pipeline setup which memory type to use. This should probably |
| 1151 // be decided based on an argument to Initialize(). | 1151 // be decided based on an argument to Initialize(). |
| 1152 if (image_processor_.get()) | 1152 if (image_processor_.get()) |
| 1153 input_memory_type_ = V4L2_MEMORY_DMABUF; | 1153 input_memory_type_ = V4L2_MEMORY_DMABUF; |
| 1154 else | 1154 else |
| 1155 input_memory_type_ = V4L2_MEMORY_USERPTR; | 1155 input_memory_type_ = V4L2_MEMORY_USERPTR; |
| 1156 | 1156 |
| 1157 reqbufs.memory = input_memory_type_; | 1157 reqbufs.memory = input_memory_type_; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 reqbufs.count = 0; | 1239 reqbufs.count = 0; |
| 1240 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1240 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| 1241 reqbufs.memory = V4L2_MEMORY_MMAP; | 1241 reqbufs.memory = V4L2_MEMORY_MMAP; |
| 1242 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); | 1242 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); |
| 1243 | 1243 |
| 1244 output_buffer_map_.clear(); | 1244 output_buffer_map_.clear(); |
| 1245 free_output_buffers_.clear(); | 1245 free_output_buffers_.clear(); |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 } // namespace media | 1248 } // namespace media |
| OLD | NEW |