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 DLOGF(level) DLOG(level) << __FUNCTION__ << "(): " | 35 #define DLOGF(level) DLOG(level) << __FUNCTION__ << "(): " |
35 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " | 36 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 for (auto picture_buffer_id : picture_buffer_ids) { | 814 for (auto picture_buffer_id : picture_buffer_ids) { |
814 DVLOGF(1) << "dismissing PictureBuffer id=" << picture_buffer_id; | 815 DVLOGF(1) << "dismissing PictureBuffer id=" << picture_buffer_id; |
815 client_->DismissPictureBuffer(picture_buffer_id); | 816 client_->DismissPictureBuffer(picture_buffer_id); |
816 } | 817 } |
817 | 818 |
818 done->Signal(); | 819 done->Signal(); |
819 } | 820 } |
820 | 821 |
821 void V4L2SliceVideoDecodeAccelerator::DevicePollTask(bool poll_device) { | 822 void V4L2SliceVideoDecodeAccelerator::DevicePollTask(bool poll_device) { |
822 DVLOGF(4); | 823 DVLOGF(4); |
823 DCHECK_EQ(device_poll_thread_.message_loop(), base::MessageLoop::current()); | 824 DCHECK(device_poll_thread_.task_runner()->BelongsToCurrentThread()); |
824 | 825 |
825 bool event_pending; | 826 bool event_pending; |
826 if (!device_->Poll(poll_device, &event_pending)) { | 827 if (!device_->Poll(poll_device, &event_pending)) { |
827 NOTIFY_ERROR(PLATFORM_FAILURE); | 828 NOTIFY_ERROR(PLATFORM_FAILURE); |
828 return; | 829 return; |
829 } | 830 } |
830 | 831 |
831 // All processing should happen on ServiceDeviceTask(), since we shouldn't | 832 // All processing should happen on ServiceDeviceTask(), since we shouldn't |
832 // touch encoder state from this thread. | 833 // touch encoder state from this thread. |
833 decoder_thread_task_runner_->PostTask( | 834 decoder_thread_task_runner_->PostTask( |
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2803 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 2804 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
2804 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); | 2805 scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder); |
2805 if (!device) | 2806 if (!device) |
2806 return SupportedProfiles(); | 2807 return SupportedProfiles(); |
2807 | 2808 |
2808 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 2809 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
2809 supported_input_fourccs_); | 2810 supported_input_fourccs_); |
2810 } | 2811 } |
2811 | 2812 |
2812 } // namespace media | 2813 } // namespace media |
OLD | NEW |