| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 unsigned RendererGpuVideoAcceleratorFactories::ImageTextureTarget( | 240 unsigned RendererGpuVideoAcceleratorFactories::ImageTextureTarget( |
| 241 gfx::BufferFormat format) { | 241 gfx::BufferFormat format) { |
| 242 auto found = image_texture_targets_.find(cc::BufferToTextureTargetKey( | 242 auto found = image_texture_targets_.find(cc::BufferToTextureTargetKey( |
| 243 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, format)); | 243 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, format)); |
| 244 DCHECK(found != image_texture_targets_.end()); | 244 DCHECK(found != image_texture_targets_.end()); |
| 245 return found->second; | 245 return found->second; |
| 246 } | 246 } |
| 247 | 247 |
| 248 media::GpuVideoAcceleratorFactories::OutputFormat | 248 media::GpuVideoAcceleratorFactories::OutputFormat |
| 249 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() { | 249 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat( |
| 250 media::VideoPixelFormat format) { |
| 250 DCHECK(task_runner_->BelongsToCurrentThread()); | 251 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 251 if (CheckContextLost()) | 252 if (CheckContextLost()) |
| 252 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; | 253 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; |
| 253 cc::ContextProvider::ScopedContextLock lock(context_provider_); | 254 cc::ContextProvider::ScopedContextLock lock(context_provider_); |
| 254 auto capabilities = context_provider_->ContextCapabilities(); | 255 auto capabilities = context_provider_->ContextCapabilities(); |
| 256 if (format == media::PIXEL_FORMAT_Y16) |
| 257 return capabilities.texture_rg |
| 258 ? media::GpuVideoAcceleratorFactories::OutputFormat::Y16 |
| 259 : media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; |
| 255 if (capabilities.image_ycbcr_420v) | 260 if (capabilities.image_ycbcr_420v) |
| 256 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB; | 261 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB; |
| 257 if (capabilities.image_ycbcr_422) | 262 if (capabilities.image_ycbcr_422) |
| 258 return media::GpuVideoAcceleratorFactories::OutputFormat::UYVY; | 263 return media::GpuVideoAcceleratorFactories::OutputFormat::UYVY; |
| 259 if (capabilities.texture_rg) | 264 if (capabilities.texture_rg) |
| 260 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_DUAL_GMB; | 265 return media::GpuVideoAcceleratorFactories::OutputFormat::NV12_DUAL_GMB; |
| 261 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; | 266 return media::GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED; |
| 262 } | 267 } |
| 263 | 268 |
| 264 namespace { | 269 namespace { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 context_provider_refptr_ = nullptr; | 321 context_provider_refptr_ = nullptr; |
| 317 } | 322 } |
| 318 | 323 |
| 319 scoped_refptr<ContextProviderCommandBuffer> | 324 scoped_refptr<ContextProviderCommandBuffer> |
| 320 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { | 325 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { |
| 321 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 326 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 322 return context_provider_refptr_; | 327 return context_provider_refptr_; |
| 323 } | 328 } |
| 324 | 329 |
| 325 } // namespace content | 330 } // namespace content |
| OLD | NEW |