Chromium Code Reviews| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 void V4L2ImageProcessor::DestroyTask() { | 207 void V4L2ImageProcessor::DestroyTask() { |
| 208 DCHECK_EQ(device_thread_.message_loop(), base::MessageLoop::current()); | 208 DCHECK_EQ(device_thread_.message_loop(), base::MessageLoop::current()); |
| 209 | 209 |
| 210 device_weak_factory_.InvalidateWeakPtrs(); | 210 device_weak_factory_.InvalidateWeakPtrs(); |
| 211 | 211 |
| 212 // Stop streaming and the device_poll_thread_. | 212 // Stop streaming and the device_poll_thread_. |
| 213 StopDevicePoll(); | 213 StopDevicePoll(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bool V4L2ImageProcessor::CreateInputBuffers() { | 216 bool V4L2ImageProcessor::CreateInputBuffers() { |
| 217 DVLOG(3) << __func__; | |
|
kcwu
2014/08/15 10:19:17
Is this intended for future use or just forgot to
wuchengli
2014/08/18 07:08:13
This is added intentional. We often want to know i
| |
| 217 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); | 218 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); |
| 218 DCHECK(!input_streamon_); | 219 DCHECK(!input_streamon_); |
| 219 | 220 |
| 220 struct v4l2_control control; | 221 struct v4l2_control control; |
| 221 memset(&control, 0, sizeof(control)); | 222 memset(&control, 0, sizeof(control)); |
| 222 control.id = V4L2_CID_ROTATE; | 223 control.id = V4L2_CID_ROTATE; |
| 223 control.value = 0; | 224 control.value = 0; |
| 224 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_CTRL, &control); | 225 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_CTRL, &control); |
| 225 | 226 |
| 226 memset(&control, 0, sizeof(control)); | 227 memset(&control, 0, sizeof(control)); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 DCHECK(input_buffer_map_.empty()); | 278 DCHECK(input_buffer_map_.empty()); |
| 278 input_buffer_map_.resize(reqbufs.count); | 279 input_buffer_map_.resize(reqbufs.count); |
| 279 | 280 |
| 280 for (size_t i = 0; i < input_buffer_map_.size(); ++i) | 281 for (size_t i = 0; i < input_buffer_map_.size(); ++i) |
| 281 free_input_buffers_.push_back(i); | 282 free_input_buffers_.push_back(i); |
| 282 | 283 |
| 283 return true; | 284 return true; |
| 284 } | 285 } |
| 285 | 286 |
| 286 bool V4L2ImageProcessor::CreateOutputBuffers() { | 287 bool V4L2ImageProcessor::CreateOutputBuffers() { |
| 288 DVLOG(3) << __func__; | |
| 287 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); | 289 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); |
| 288 DCHECK(!output_streamon_); | 290 DCHECK(!output_streamon_); |
| 289 | 291 |
| 290 struct v4l2_format format; | 292 struct v4l2_format format; |
| 291 memset(&format, 0, sizeof(format)); | 293 memset(&format, 0, sizeof(format)); |
| 292 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 294 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| 293 format.fmt.pix_mp.width = output_allocated_size_.width(); | 295 format.fmt.pix_mp.width = output_allocated_size_.width(); |
| 294 format.fmt.pix_mp.height = output_allocated_size_.height(); | 296 format.fmt.pix_mp.height = output_allocated_size_.height(); |
| 295 format.fmt.pix_mp.pixelformat = output_format_fourcc_; | 297 format.fmt.pix_mp.pixelformat = output_format_fourcc_; |
| 296 format.fmt.pix_mp.num_planes = output_planes_count_; | 298 format.fmt.pix_mp.num_planes = output_planes_count_; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 output_record.at_device = false; | 710 output_record.at_device = false; |
| 709 if (!output_record.at_client) | 711 if (!output_record.at_client) |
| 710 free_output_buffers_.push_back(i); | 712 free_output_buffers_.push_back(i); |
| 711 } | 713 } |
| 712 output_buffer_queued_count_ = 0; | 714 output_buffer_queued_count_ = 0; |
| 713 | 715 |
| 714 return true; | 716 return true; |
| 715 } | 717 } |
| 716 | 718 |
| 717 } // namespace content | 719 } // namespace content |
| OLD | NEW |