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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
7 #include <poll.h> | 7 #include <poll.h> |
8 #include <sys/eventfd.h> | 8 #include <sys/eventfd.h> |
9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 DVLOG(3) << "UseOutputBitstreamBuffer(): id=" << buffer.id(); | 215 DVLOG(3) << "UseOutputBitstreamBuffer(): id=" << buffer.id(); |
216 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 216 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
217 | 217 |
218 if (buffer.size() < output_buffer_byte_size_) { | 218 if (buffer.size() < output_buffer_byte_size_) { |
219 NOTIFY_ERROR(kInvalidArgumentError); | 219 NOTIFY_ERROR(kInvalidArgumentError); |
220 return; | 220 return; |
221 } | 221 } |
222 | 222 |
223 scoped_ptr<base::SharedMemory> shm( | 223 scoped_ptr<base::SharedMemory> shm( |
224 new base::SharedMemory(buffer.handle(), false)); | 224 new base::SharedMemory(buffer.handle(), false)); |
225 if (!shm->Map(buffer.size())) { | 225 if (!shm->MapAt(buffer.offset(), buffer.size())) { |
226 NOTIFY_ERROR(kPlatformFailureError); | 226 NOTIFY_ERROR(kPlatformFailureError); |
227 return; | 227 return; |
228 } | 228 } |
229 | 229 |
230 scoped_ptr<BitstreamBufferRef> buffer_ref( | 230 scoped_ptr<BitstreamBufferRef> buffer_ref( |
231 new BitstreamBufferRef(buffer.id(), shm.Pass(), buffer.size())); | 231 new BitstreamBufferRef(buffer.id(), shm.Pass(), buffer.size())); |
232 encoder_thread_.message_loop()->PostTask( | 232 encoder_thread_.message_loop()->PostTask( |
233 FROM_HERE, | 233 FROM_HERE, |
234 base::Bind(&V4L2VideoEncodeAccelerator::UseOutputBitstreamBufferTask, | 234 base::Bind(&V4L2VideoEncodeAccelerator::UseOutputBitstreamBufferTask, |
235 base::Unretained(this), | 235 base::Unretained(this), |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 reqbufs.count = 0; | 1157 reqbufs.count = 0; |
1158 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 1158 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
1159 reqbufs.memory = V4L2_MEMORY_MMAP; | 1159 reqbufs.memory = V4L2_MEMORY_MMAP; |
1160 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); | 1160 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); |
1161 | 1161 |
1162 output_buffer_map_.clear(); | 1162 output_buffer_map_.clear(); |
1163 free_output_buffers_.clear(); | 1163 free_output_buffers_.clear(); |
1164 } | 1164 } |
1165 | 1165 |
1166 } // namespace content | 1166 } // namespace content |
OLD | NEW |