| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_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" |
| (...skipping 13 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) | 34 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 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" |
| 36 #include "ui/gl/gl_implementation.h" | 37 #include "ui/gl/gl_implementation.h" |
| 37 #elif defined(USE_OZONE) | 38 #elif defined(USE_OZONE) |
| 38 #include "media/ozone/media_ozone_platform.h" | 39 #include "media/ozone/media_ozone_platform.h" |
| 39 #elif defined(OS_ANDROID) | 40 #elif defined(OS_ANDROID) |
| 40 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 41 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 #include "ui/gfx/size.h" | 44 #include "ui/gfx/size.h" |
| 44 | 45 |
| 45 namespace content { | 46 namespace content { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 SendCreateDecoderReply(init_done_msg, false); | 265 SendCreateDecoderReply(init_done_msg, false); |
| 265 return; | 266 return; |
| 266 } | 267 } |
| 267 video_decode_accelerator_.reset(new V4L2VideoDecodeAccelerator( | 268 video_decode_accelerator_.reset(new V4L2VideoDecodeAccelerator( |
| 268 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 269 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
| 269 stub_->decoder()->GetGLContext()->GetHandle(), | 270 stub_->decoder()->GetGLContext()->GetHandle(), |
| 270 weak_factory_for_io_.GetWeakPtr(), | 271 weak_factory_for_io_.GetWeakPtr(), |
| 271 make_context_current_, | 272 make_context_current_, |
| 272 device.Pass(), | 273 device.Pass(), |
| 273 io_message_loop_)); | 274 io_message_loop_)); |
| 274 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 275 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 275 video_decode_accelerator_.reset( | 276 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { |
| 276 new VaapiVideoDecodeAccelerator(make_context_current_)); | 277 VLOG(1) << "HW video decode acceleration not available without " |
| 278 "DesktopGL (GLX)."; |
| 279 SendCreateDecoderReply(init_done_msg, false); |
| 280 return; |
| 281 } |
| 282 gfx::GLContextGLX* glx_context = |
| 283 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); |
| 284 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( |
| 285 glx_context->display(), make_context_current_)); |
| 277 #elif defined(USE_OZONE) | 286 #elif defined(USE_OZONE) |
| 278 media::MediaOzonePlatform* platform = | 287 media::MediaOzonePlatform* platform = |
| 279 media::MediaOzonePlatform::GetInstance(); | 288 media::MediaOzonePlatform::GetInstance(); |
| 280 video_decode_accelerator_.reset(platform->CreateVideoDecodeAccelerator( | 289 video_decode_accelerator_.reset(platform->CreateVideoDecodeAccelerator( |
| 281 make_context_current_)); | 290 make_context_current_)); |
| 282 if (!video_decode_accelerator_) { | 291 if (!video_decode_accelerator_) { |
| 283 SendCreateDecoderReply(init_done_msg, false); | 292 SendCreateDecoderReply(init_done_msg, false); |
| 284 return; | 293 return; |
| 285 } | 294 } |
| 286 #elif defined(OS_ANDROID) | 295 #elif defined(OS_ANDROID) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 return stub_->channel()->Send(message); | 514 return stub_->channel()->Send(message); |
| 506 } | 515 } |
| 507 | 516 |
| 508 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 517 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 509 bool succeeded) { | 518 bool succeeded) { |
| 510 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 519 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 511 Send(message); | 520 Send(message); |
| 512 } | 521 } |
| 513 | 522 |
| 514 } // namespace content | 523 } // namespace content |
| OLD | NEW |