OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
Pawel Osciak
2014/08/25 01:13:23
With TEST=None in CL description, how was this tes
| |
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_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
24 #include "ui/gl/gl_surface_egl.h" | 24 #include "ui/gl/gl_surface_egl.h" |
25 | 25 |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 28 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
29 #elif defined(OS_MACOSX) | 29 #elif defined(OS_MACOSX) |
30 #include "content/common/gpu/media/vt_video_decode_accelerator.h" | 30 #include "content/common/gpu/media/vt_video_decode_accelerator.h" |
31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
32 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 32 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
33 #include "content/common/gpu/media/v4l2_video_device.h" | 33 #include "content/common/gpu/media/v4l2_video_device.h" |
34 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 34 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
35 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 35 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
36 #include "ui/gl/gl_context_glx.h" | |
37 #include "ui/gl/gl_implementation.h" | 36 #include "ui/gl/gl_implementation.h" |
38 #elif defined(USE_OZONE) | 37 #elif defined(USE_OZONE) |
39 #include "media/ozone/media_ozone_platform.h" | 38 #include "media/ozone/media_ozone_platform.h" |
40 #elif defined(OS_ANDROID) | 39 #elif defined(OS_ANDROID) |
41 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 40 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
42 #endif | 41 #endif |
43 | 42 |
44 #include "ui/gfx/size.h" | 43 #include "ui/gfx/size.h" |
45 | 44 |
46 namespace content { | 45 namespace content { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 SendCreateDecoderReply(init_done_msg, false); | 264 SendCreateDecoderReply(init_done_msg, false); |
266 return; | 265 return; |
267 } | 266 } |
268 video_decode_accelerator_.reset(new V4L2VideoDecodeAccelerator( | 267 video_decode_accelerator_.reset(new V4L2VideoDecodeAccelerator( |
269 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 268 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
270 stub_->decoder()->GetGLContext()->GetHandle(), | 269 stub_->decoder()->GetGLContext()->GetHandle(), |
271 weak_factory_for_io_.GetWeakPtr(), | 270 weak_factory_for_io_.GetWeakPtr(), |
272 make_context_current_, | 271 make_context_current_, |
273 device.Pass(), | 272 device.Pass(), |
274 io_message_loop_)); | 273 io_message_loop_)); |
275 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 274 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
275 #if defined(USE_X11) | |
Pawel Osciak
2014/08/25 01:13:23
Do we need to make the X11 decision here? Could Va
| |
276 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { | 276 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { |
277 VLOG(1) << "HW video decode acceleration not available without " | 277 VLOG(1) << "HW video decode acceleration not available without " |
278 "DesktopGL (GLX)."; | 278 "DesktopGL (GLX)."; |
279 SendCreateDecoderReply(init_done_msg, false); | 279 SendCreateDecoderReply(init_done_msg, false); |
280 return; | 280 return; |
281 } | 281 } |
282 gfx::GLContextGLX* glx_context = | 282 #else |
283 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); | 283 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
284 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( | 284 VLOG(1) << "HW video decode acceleration not available without " |
Pawel Osciak
2014/08/25 01:13:23
Please use DVLOG or DLOG
| |
285 glx_context->display(), make_context_current_)); | 285 "EGLGLES2."; |
286 #elif defined(USE_OZONE) | |
287 media::MediaOzonePlatform* platform = | |
spang
2014/08/22 17:20:23
I would like to move the vaapi & v4l2 code out of
Pawel Osciak
2014/08/25 01:13:23
Could you please explain why and how/to where woul
spang
2014/08/28 19:52:08
I was thinking we should move it to media/ somewhe
Pawel Osciak
2014/08/29 11:26:29
Agreed, but as you said, VDA impl choice is orthog
| |
288 media::MediaOzonePlatform::GetInstance(); | |
289 video_decode_accelerator_.reset(platform->CreateVideoDecodeAccelerator( | |
290 make_context_current_)); | |
291 if (!video_decode_accelerator_) { | |
292 SendCreateDecoderReply(init_done_msg, false); | 286 SendCreateDecoderReply(init_done_msg, false); |
293 return; | 287 return; |
294 } | 288 } |
289 #endif // USE_X11 | |
290 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( | |
291 stub_->decoder()->GetGLContext(), make_context_current_)); | |
295 #elif defined(OS_ANDROID) | 292 #elif defined(OS_ANDROID) |
296 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( | 293 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( |
297 stub_->decoder()->AsWeakPtr(), | 294 stub_->decoder()->AsWeakPtr(), |
298 make_context_current_)); | 295 make_context_current_)); |
299 #else | 296 #else |
300 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 297 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
301 SendCreateDecoderReply(init_done_msg, false); | 298 SendCreateDecoderReply(init_done_msg, false); |
302 return; | 299 return; |
303 #endif | 300 #endif |
304 | 301 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 return stub_->channel()->Send(message); | 503 return stub_->channel()->Send(message); |
507 } | 504 } |
508 | 505 |
509 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 506 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
510 bool succeeded) { | 507 bool succeeded) { |
511 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 508 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
512 Send(message); | 509 Send(message); |
513 } | 510 } |
514 | 511 |
515 } // namespace content | 512 } // namespace content |
OLD | NEW |