| 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 10 matching lines...) Expand all Loading... |
| 21 #include "media/base/limits.h" | 21 #include "media/base/limits.h" |
| 22 #include "ui/gl/gl_context.h" | 22 #include "ui/gl/gl_context.h" |
| 23 #include "ui/gl/gl_surface_egl.h" | 23 #include "ui/gl/gl_surface_egl.h" |
| 24 | 24 |
| 25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 26 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
| 27 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 27 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 28 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 28 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
| 29 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" | 29 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" |
| 30 #include "content/common/gpu/media/v4l2_video_device.h" | 30 #include "content/common/gpu/media/v4l2_video_device.h" |
| 31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 32 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 32 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
| 33 #if defined(USE_X11) |
| 33 #include "ui/gl/gl_context_glx.h" | 34 #include "ui/gl/gl_context_glx.h" |
| 34 #include "ui/gl/gl_implementation.h" | 35 #include "ui/gl/gl_implementation.h" |
| 36 #endif |
| 35 #elif defined(OS_ANDROID) | 37 #elif defined(OS_ANDROID) |
| 36 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 38 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 37 #endif | 39 #endif |
| 38 | 40 |
| 39 #include "ui/gfx/size.h" | 41 #include "ui/gfx/size.h" |
| 40 | 42 |
| 41 namespace content { | 43 namespace content { |
| 42 | 44 |
| 43 static bool MakeDecoderContextCurrent( | 45 static bool MakeDecoderContextCurrent( |
| 44 const base::WeakPtr<GpuCommandBufferStub> stub) { | 46 const base::WeakPtr<GpuCommandBufferStub> stub) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 if (!device.get()) { | 259 if (!device.get()) { |
| 258 SendCreateDecoderReply(init_done_msg, false); | 260 SendCreateDecoderReply(init_done_msg, false); |
| 259 return; | 261 return; |
| 260 } | 262 } |
| 261 video_decode_accelerator_.reset( | 263 video_decode_accelerator_.reset( |
| 262 new V4L2VideoDecodeAccelerator(gfx::GLSurfaceEGL::GetHardwareDisplay(), | 264 new V4L2VideoDecodeAccelerator(gfx::GLSurfaceEGL::GetHardwareDisplay(), |
| 263 weak_factory_for_io_.GetWeakPtr(), | 265 weak_factory_for_io_.GetWeakPtr(), |
| 264 make_context_current_, | 266 make_context_current_, |
| 265 device.Pass(), | 267 device.Pass(), |
| 266 io_message_loop_)); | 268 io_message_loop_)); |
| 267 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 269 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 270 #if defined(USE_X11) |
| 268 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { | 271 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { |
| 269 VLOG(1) << "HW video decode acceleration not available without " | 272 VLOG(1) << "HW video decode acceleration not available without " |
| 270 "DesktopGL (GLX)."; | 273 "DesktopGL (GLX)."; |
| 271 SendCreateDecoderReply(init_done_msg, false); | 274 SendCreateDecoderReply(init_done_msg, false); |
| 272 return; | 275 return; |
| 273 } | 276 } |
| 274 gfx::GLContextGLX* glx_context = | 277 gfx::GLContextGLX* glx_context = |
| 275 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); | 278 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); |
| 276 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( | 279 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( |
| 277 glx_context->display(), make_context_current_)); | 280 glx_context->display(), make_context_current_)); |
| 281 #elif defined(USE_OZONE) |
| 282 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( |
| 283 make_context_current_)); |
| 284 #endif |
| 278 #elif defined(OS_ANDROID) | 285 #elif defined(OS_ANDROID) |
| 279 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( | 286 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( |
| 280 stub_->decoder()->AsWeakPtr(), | 287 stub_->decoder()->AsWeakPtr(), |
| 281 make_context_current_)); | 288 make_context_current_)); |
| 282 #else | 289 #else |
| 283 NOTIMPLEMENTED() << "HW video decode acceleration not available."; | 290 NOTIMPLEMENTED() << "HW video decode acceleration not available."; |
| 284 SendCreateDecoderReply(init_done_msg, false); | 291 SendCreateDecoderReply(init_done_msg, false); |
| 285 return; | 292 return; |
| 286 #endif | 293 #endif |
| 287 | 294 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 return stub_->channel()->Send(message); | 497 return stub_->channel()->Send(message); |
| 491 } | 498 } |
| 492 | 499 |
| 493 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 500 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 494 bool succeeded) { | 501 bool succeeded) { |
| 495 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 502 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 496 Send(message); | 503 Send(message); |
| 497 } | 504 } |
| 498 | 505 |
| 499 } // namespace content | 506 } // namespace content |
| OLD | NEW |