| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/media/renderer_gpu_video_accelerator_factories.h" | 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return image_texture_targets_[static_cast<int>(format)]; | 218 return image_texture_targets_[static_cast<int>(format)]; |
| 219 } | 219 } |
| 220 | 220 |
| 221 media::VideoPixelFormat | 221 media::VideoPixelFormat |
| 222 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() { | 222 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() { |
| 223 DCHECK(task_runner_->BelongsToCurrentThread()); | 223 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 224 if (CheckContextLost()) | 224 if (CheckContextLost()) |
| 225 return media::PIXEL_FORMAT_UNKNOWN; | 225 return media::PIXEL_FORMAT_UNKNOWN; |
| 226 cc::ContextProvider::ScopedContextLock lock(context_provider_); | 226 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
| 227 auto capabilities = context_provider_->ContextCapabilities(); | 227 auto capabilities = context_provider_->ContextCapabilities(); |
| 228 if (capabilities.gpu.image_ycbcr_420v) | |
| 229 return media::PIXEL_FORMAT_NV12; | |
| 230 if (capabilities.gpu.image_ycbcr_422) | 228 if (capabilities.gpu.image_ycbcr_422) |
| 231 return media::PIXEL_FORMAT_UYVY; | 229 return media::PIXEL_FORMAT_UYVY; |
| 232 if (capabilities.gpu.texture_rg) | 230 if (capabilities.gpu.texture_rg) |
| 233 return media::PIXEL_FORMAT_I420; | 231 return media::PIXEL_FORMAT_I420; |
| 234 return media::PIXEL_FORMAT_UNKNOWN; | 232 return media::PIXEL_FORMAT_UNKNOWN; |
| 235 } | 233 } |
| 236 | 234 |
| 237 namespace { | 235 namespace { |
| 238 class ScopedGLContextLockImpl | 236 class ScopedGLContextLockImpl |
| 239 : public media::GpuVideoAcceleratorFactories::ScopedGLContextLock { | 237 : public media::GpuVideoAcceleratorFactories::ScopedGLContextLock { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 context_provider_refptr_ = nullptr; | 287 context_provider_refptr_ = nullptr; |
| 290 } | 288 } |
| 291 | 289 |
| 292 scoped_refptr<ContextProviderCommandBuffer> | 290 scoped_refptr<ContextProviderCommandBuffer> |
| 293 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { | 291 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { |
| 294 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 292 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 295 return context_provider_refptr_; | 293 return context_provider_refptr_; |
| 296 } | 294 } |
| 297 | 295 |
| 298 } // namespace content | 296 } // namespace content |
| OLD | NEW |