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 "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "content/common/gpu/gpu_channel.h" | 14 #include "content/common/gpu/gpu_channel.h" |
15 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
16 #include "ipc/ipc_message_macros.h" | 16 #include "ipc/ipc_message_macros.h" |
17 #include "ipc/message_filter.h" | 17 #include "ipc/message_filter.h" |
18 #include "media/filters/jpeg_parser.h" | 18 #include "media/filters/jpeg_parser.h" |
19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
20 | 20 |
21 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 21 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
wuchengli
2015/05/25 10:29:23
#if defined(OS_CHROMEOS)
#if defined(ARCH_CPU_X8
henryhsu
2015/06/05 03:28:55
Done.
| |
22 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" | 22 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" |
23 #elif defined(USE_V4L2_CODEC) | |
24 #include "content/common/gpu/media/v4l2_device.h" | |
25 #include "content/common/gpu/media/v4l2_jpeg_decode_accelerator.h" | |
23 #endif | 26 #endif |
24 | 27 |
25 namespace base { | 28 namespace base { |
26 | 29 |
27 void DefaultDeleter<content::GpuJpegDecodeAccelerator>::operator()( | 30 void DefaultDeleter<content::GpuJpegDecodeAccelerator>::operator()( |
28 void* jpeg_decode_accelerator) const { | 31 void* jpeg_decode_accelerator) const { |
29 static_cast<content::GpuJpegDecodeAccelerator*>(jpeg_decode_accelerator) | 32 static_cast<content::GpuJpegDecodeAccelerator*>(jpeg_decode_accelerator) |
30 ->Destroy(); | 33 ->Destroy(); |
31 } | 34 } |
32 | 35 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 | 108 |
106 bool GpuJpegDecodeAccelerator::Initialize() { | 109 bool GpuJpegDecodeAccelerator::Initialize() { |
107 DCHECK(child_message_loop_->BelongsToCurrentThread()); | 110 DCHECK(child_message_loop_->BelongsToCurrentThread()); |
108 DCHECK(!jpeg_decode_accelerator_.get()); | 111 DCHECK(!jpeg_decode_accelerator_.get()); |
109 | 112 |
110 // When adding more platforms, GpuJpegDecodeAcceleratorAdapter::Supported need | 113 // When adding more platforms, GpuJpegDecodeAcceleratorAdapter::Supported need |
111 // update as well. | 114 // update as well. |
112 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 115 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
113 jpeg_decode_accelerator_.reset( | 116 jpeg_decode_accelerator_.reset( |
114 new VaapiJpegDecodeAccelerator(io_message_loop_)); | 117 new VaapiJpegDecodeAccelerator(io_message_loop_)); |
118 #elif defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
119 scoped_refptr<V4L2Device> device = V4L2Device::Create( | |
120 V4L2Device::kJpegDecoder); | |
121 if (device.get()) { | |
122 jpeg_decode_accelerator_.reset(new V4L2JpegDecodeAccelerator( | |
123 device, | |
124 io_message_loop_)); | |
125 } | |
115 #else | 126 #else |
116 DVLOG(1) << "HW JPEG decode acceleration not available."; | 127 DVLOG(1) << "HW JPEG decode acceleration not available."; |
117 return false; | 128 return false; |
118 #endif | 129 #endif |
119 | 130 |
120 if (!channel_->AddRoute(host_route_id_, this)) { | 131 if (!channel_->AddRoute(host_route_id_, this)) { |
121 LOG(ERROR) << "GpuJpegDecodeAccelerator::Initialize(): " | 132 LOG(ERROR) << "GpuJpegDecodeAccelerator::Initialize(): " |
122 "failed to add route"; | 133 "failed to add route"; |
123 return false; | 134 return false; |
124 } | 135 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 delete this; | 243 delete this; |
233 } | 244 } |
234 | 245 |
235 bool GpuJpegDecodeAccelerator::Send(IPC::Message* message) { | 246 bool GpuJpegDecodeAccelerator::Send(IPC::Message* message) { |
236 if (io_message_loop_->BelongsToCurrentThread()) | 247 if (io_message_loop_->BelongsToCurrentThread()) |
237 return filter_->SendOnIOThread(message); | 248 return filter_->SendOnIOThread(message); |
238 return channel_->Send(message); | 249 return channel_->Send(message); |
239 } | 250 } |
240 | 251 |
241 } // namespace content | 252 } // namespace content |
OLD | NEW |