| 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/exynos_video_decode_accelerator.h" | 29 #include "content/common/gpu/media/exynos_video_decode_accelerator.h" |
| 30 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 30 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 31 #include "ui/gl/gl_context_glx.h" |
| 31 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 32 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
| 32 #include "ui/gl/gl_context_glx.h" | |
| 33 #include "ui/gl/gl_implementation.h" | |
| 34 #elif defined(OS_ANDROID) | 33 #elif defined(OS_ANDROID) |
| 35 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 34 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 36 #endif | 35 #endif |
| 37 | 36 |
| 38 #include "ui/gfx/size.h" | 37 #include "ui/gfx/size.h" |
| 39 | 38 |
| 40 namespace content { | 39 namespace content { |
| 41 | 40 |
| 42 static bool MakeDecoderContextCurrent( | 41 static bool MakeDecoderContextCurrent( |
| 43 const base::WeakPtr<GpuCommandBufferStub> stub) { | 42 const base::WeakPtr<GpuCommandBufferStub> stub) { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator( | 271 video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator( |
| 273 this, make_context_current_)); | 272 this, make_context_current_)); |
| 274 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) | 273 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) && defined(USE_X11) |
| 275 video_decode_accelerator_.reset(new ExynosVideoDecodeAccelerator( | 274 video_decode_accelerator_.reset(new ExynosVideoDecodeAccelerator( |
| 276 gfx::GLSurfaceEGL::GetHardwareDisplay(), | 275 gfx::GLSurfaceEGL::GetHardwareDisplay(), |
| 277 this, | 276 this, |
| 278 weak_factory_for_io_.GetWeakPtr(), | 277 weak_factory_for_io_.GetWeakPtr(), |
| 279 make_context_current_, | 278 make_context_current_, |
| 280 io_message_loop_)); | 279 io_message_loop_)); |
| 281 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 280 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
| 282 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { | |
| 283 VLOG(1) << "HW video decode acceleration not available without " | |
| 284 "DesktopGL (GLX)."; | |
| 285 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | |
| 286 return; | |
| 287 } | |
| 288 gfx::GLContextGLX* glx_context = | 281 gfx::GLContextGLX* glx_context = |
| 289 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); | 282 static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext()); |
| 290 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( | 283 video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( |
| 291 glx_context->display(), this, make_context_current_)); | 284 glx_context->display(), this, make_context_current_)); |
| 292 #elif defined(OS_ANDROID) | 285 #elif defined(OS_ANDROID) |
| 293 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( | 286 video_decode_accelerator_.reset(new AndroidVideoDecodeAccelerator( |
| 294 this, | 287 this, |
| 295 stub_->decoder()->AsWeakPtr(), | 288 stub_->decoder()->AsWeakPtr(), |
| 296 make_context_current_)); | 289 make_context_current_)); |
| 297 #else | 290 #else |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second; | 496 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second; |
| 504 GLenum target = texture_ref->texture()->target(); | 497 GLenum target = texture_ref->texture()->target(); |
| 505 gpu::gles2::TextureManager* texture_manager = | 498 gpu::gles2::TextureManager* texture_manager = |
| 506 stub_->decoder()->GetContextGroup()->texture_manager(); | 499 stub_->decoder()->GetContextGroup()->texture_manager(); |
| 507 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); | 500 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); |
| 508 texture_manager->SetLevelCleared(texture_ref, target, 0, true); | 501 texture_manager->SetLevelCleared(texture_ref, target, 0, true); |
| 509 uncleared_textures_.erase(it); | 502 uncleared_textures_.erase(it); |
| 510 } | 503 } |
| 511 | 504 |
| 512 } // namespace content | 505 } // namespace content |
| OLD | NEW |