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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/bind_to_current_loop.h" |
14 #include "base/callback.h" | 15 #include "base/callback.h" |
15 #include "base/message_loop/message_loop_proxy.h" | 16 #include "base/message_loop/message_loop_proxy.h" |
16 #include "base/numerics/safe_conversions.h" | 17 #include "base/numerics/safe_conversions.h" |
17 #include "content/common/gpu/media/v4l2_image_processor.h" | 18 #include "content/common/gpu/media/v4l2_image_processor.h" |
18 #include "media/base/bind_to_current_loop.h" | |
19 | 19 |
20 #define NOTIFY_ERROR() \ | 20 #define NOTIFY_ERROR() \ |
21 do { \ | 21 do { \ |
22 LOG(ERROR) << "calling NotifyError()"; \ | 22 LOG(ERROR) << "calling NotifyError()"; \ |
23 NotifyError(); \ | 23 NotifyError(); \ |
24 } while (0) | 24 } while (0) |
25 | 25 |
26 #define IOCTL_OR_ERROR_RETURN_VALUE(type, arg, value) \ | 26 #define IOCTL_OR_ERROR_RETURN_VALUE(type, arg, value) \ |
27 do { \ | 27 do { \ |
28 if (device_->Ioctl(type, arg) != 0) { \ | 28 if (device_->Ioctl(type, arg) != 0) { \ |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 running_jobs_.pop(); | 555 running_jobs_.pop(); |
556 | 556 |
557 scoped_refptr<media::VideoFrame> output_frame = | 557 scoped_refptr<media::VideoFrame> output_frame = |
558 media::VideoFrame::WrapExternalDmabufs( | 558 media::VideoFrame::WrapExternalDmabufs( |
559 output_format_, | 559 output_format_, |
560 output_allocated_size_, | 560 output_allocated_size_, |
561 gfx::Rect(output_visible_size_), | 561 gfx::Rect(output_visible_size_), |
562 output_visible_size_, | 562 output_visible_size_, |
563 output_record.fds, | 563 output_record.fds, |
564 job_record->frame->timestamp(), | 564 job_record->frame->timestamp(), |
565 media::BindToCurrentLoop( | 565 base::BindToCurrentLoop( |
566 base::Bind(&V4L2ImageProcessor::ReuseOutputBuffer, | 566 base::Bind(&V4L2ImageProcessor::ReuseOutputBuffer, |
567 device_weak_factory_.GetWeakPtr(), | 567 device_weak_factory_.GetWeakPtr(), |
568 dqbuf.index))); | 568 dqbuf.index))); |
569 | 569 |
570 DVLOG(3) << "Processing finished, returning frame, ts=" | 570 DVLOG(3) << "Processing finished, returning frame, ts=" |
571 << output_frame->timestamp().InMilliseconds(); | 571 << output_frame->timestamp().InMilliseconds(); |
572 | 572 |
573 child_message_loop_proxy_->PostTask( | 573 child_message_loop_proxy_->PostTask( |
574 FROM_HERE, base::Bind(job_record->ready_cb, output_frame)); | 574 FROM_HERE, base::Bind(job_record->ready_cb, output_frame)); |
575 } | 575 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 output_record.at_device = false; | 719 output_record.at_device = false; |
720 if (!output_record.at_client) | 720 if (!output_record.at_client) |
721 free_output_buffers_.push_back(i); | 721 free_output_buffers_.push_back(i); |
722 } | 722 } |
723 output_buffer_queued_count_ = 0; | 723 output_buffer_queued_count_ = 0; |
724 | 724 |
725 return true; | 725 return true; |
726 } | 726 } |
727 | 727 |
728 } // namespace content | 728 } // namespace content |
OLD | NEW |