OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_slice_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_slice_video_decode_accelerator.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <linux/videodev2.h> | 9 #include <linux/videodev2.h> |
10 #include <poll.h> | 10 #include <poll.h> |
11 #include <string.h> | 11 #include <string.h> |
12 #include <sys/eventfd.h> | 12 #include <sys/eventfd.h> |
13 #include <sys/ioctl.h> | 13 #include <sys/ioctl.h> |
14 #include <sys/mman.h> | 14 #include <sys/mman.h> |
15 | 15 |
16 #include <memory> | 16 #include <memory> |
17 | 17 |
18 #include "base/bind.h" | 18 #include "base/bind.h" |
19 #include "base/bind_helpers.h" | 19 #include "base/bind_helpers.h" |
20 #include "base/callback.h" | 20 #include "base/callback.h" |
21 #include "base/callback_helpers.h" | 21 #include "base/callback_helpers.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
23 #include "base/macros.h" | 23 #include "base/macros.h" |
24 #include "base/memory/ptr_util.h" | 24 #include "base/memory/ptr_util.h" |
25 #include "base/numerics/safe_conversions.h" | 25 #include "base/numerics/safe_conversions.h" |
| 26 #include "base/single_thread_task_runner.h" |
26 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
27 #include "media/base/bind_to_current_loop.h" | 28 #include "media/base/bind_to_current_loop.h" |
28 #include "media/base/media_switches.h" | 29 #include "media/base/media_switches.h" |
29 #include "media/gpu/shared_memory_region.h" | 30 #include "media/gpu/shared_memory_region.h" |
30 #include "ui/gl/gl_context.h" | 31 #include "ui/gl/gl_context.h" |
31 #include "ui/gl/scoped_binders.h" | 32 #include "ui/gl/scoped_binders.h" |
32 | 33 |
33 #define LOGF(level) LOG(level) << __FUNCTION__ << "(): " | 34 #define LOGF(level) LOG(level) << __FUNCTION__ << "(): " |
34 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " | 35 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " |
35 | 36 |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 for (auto picture_buffer_id : picture_buffer_ids) { | 811 for (auto picture_buffer_id : picture_buffer_ids) { |
811 DVLOGF(1) << "dismissing PictureBuffer id=" << picture_buffer_id; | 812 DVLOGF(1) << "dismissing PictureBuffer id=" << picture_buffer_id; |
812 client_->DismissPictureBuffer(picture_buffer_id); | 813 client_->DismissPictureBuffer(picture_buffer_id); |
813 } | 814 } |
814 | 815 |
815 done->Signal(); | 816 done->Signal(); |
816 } | 817 } |
817 | 818 |
818 void V4L2SliceVideoDecodeAccelerator::DevicePollTask(bool poll_device) { | 819 void V4L2SliceVideoDecodeAccelerator::DevicePollTask(bool poll_device) { |
819 DVLOGF(4); | 820 DVLOGF(4); |
820 DCHECK_EQ(device_poll_thread_.message_loop(), base::MessageLoop::current()); | 821 DCHECK(device_poll_thread_.task_runner()->BelongsToCurrentThread()); |
821 | 822 |
822 bool event_pending; | 823 bool event_pending; |
823 if (!device_->Poll(poll_device, &event_pending)) { | 824 if (!device_->Poll(poll_device, &event_pending)) { |
824 NOTIFY_ERROR(PLATFORM_FAILURE); | 825 NOTIFY_ERROR(PLATFORM_FAILURE); |
825 return; | 826 return; |
826 } | 827 } |
827 | 828 |
828 // All processing should happen on ServiceDeviceTask(), since we shouldn't | 829 // All processing should happen on ServiceDeviceTask(), since we shouldn't |
829 // touch encoder state from this thread. | 830 // touch encoder state from this thread. |
830 decoder_thread_task_runner_->PostTask( | 831 decoder_thread_task_runner_->PostTask( |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2801 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
2801 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2802 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
2802 if (!device) | 2803 if (!device) |
2803 return SupportedProfiles(); | 2804 return SupportedProfiles(); |
2804 | 2805 |
2805 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2806 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
2806 supported_input_fourccs_); | 2807 supported_input_fourccs_); |
2807 } | 2808 } |
2808 | 2809 |
2809 } // namespace media | 2810 } // namespace media |
OLD | NEW |