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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return image_texture_targets_[static_cast<int>(format)]; | 235 return image_texture_targets_[static_cast<int>(format)]; |
236 } | 236 } |
237 | 237 |
238 media::VideoPixelFormat | 238 media::VideoPixelFormat |
239 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() { | 239 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() { |
240 DCHECK(task_runner_->BelongsToCurrentThread()); | 240 DCHECK(task_runner_->BelongsToCurrentThread()); |
241 if (CheckContextLost()) | 241 if (CheckContextLost()) |
242 return media::PIXEL_FORMAT_UNKNOWN; | 242 return media::PIXEL_FORMAT_UNKNOWN; |
243 cc::ContextProvider::ScopedContextLock lock(context_provider_); | 243 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
244 auto capabilities = context_provider_->ContextCapabilities(); | 244 auto capabilities = context_provider_->ContextCapabilities(); |
245 if (capabilities.gpu.image_ycbcr_420v) | 245 if (capabilities.image_ycbcr_420v) |
246 return media::PIXEL_FORMAT_NV12; | 246 return media::PIXEL_FORMAT_NV12; |
247 if (capabilities.gpu.image_ycbcr_422) | 247 if (capabilities.image_ycbcr_422) |
248 return media::PIXEL_FORMAT_UYVY; | 248 return media::PIXEL_FORMAT_UYVY; |
249 if (capabilities.gpu.texture_rg) | 249 if (capabilities.texture_rg) |
250 return media::PIXEL_FORMAT_I420; | 250 return media::PIXEL_FORMAT_I420; |
251 return media::PIXEL_FORMAT_UNKNOWN; | 251 return media::PIXEL_FORMAT_UNKNOWN; |
252 } | 252 } |
253 | 253 |
254 namespace { | 254 namespace { |
255 class ScopedGLContextLockImpl | 255 class ScopedGLContextLockImpl |
256 : public media::GpuVideoAcceleratorFactories::ScopedGLContextLock { | 256 : public media::GpuVideoAcceleratorFactories::ScopedGLContextLock { |
257 public: | 257 public: |
258 ScopedGLContextLockImpl(cc::ContextProvider* context_provider) | 258 ScopedGLContextLockImpl(cc::ContextProvider* context_provider) |
259 : lock_(context_provider) {} | 259 : lock_(context_provider) {} |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 context_provider_refptr_ = nullptr; | 306 context_provider_refptr_ = nullptr; |
307 } | 307 } |
308 | 308 |
309 scoped_refptr<ContextProviderCommandBuffer> | 309 scoped_refptr<ContextProviderCommandBuffer> |
310 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { | 310 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { |
311 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 311 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
312 return context_provider_refptr_; | 312 return context_provider_refptr_; |
313 } | 313 } |
314 | 314 |
315 } // namespace content | 315 } // namespace content |
OLD | NEW |