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::VideoPixelFormat | 248 media::VideoPixelFormat |
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::PIXEL_FORMAT_UNKNOWN; | 253 return media::PIXEL_FORMAT_UNKNOWN; |
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 ? format : media::PIXEL_FORMAT_UNKNOWN; |
255 if (capabilities.image_ycbcr_420v) | 258 if (capabilities.image_ycbcr_420v) |
256 return media::PIXEL_FORMAT_NV12; | 259 return media::PIXEL_FORMAT_NV12; |
257 if (capabilities.image_ycbcr_422) | 260 if (capabilities.image_ycbcr_422) |
258 return media::PIXEL_FORMAT_UYVY; | 261 return media::PIXEL_FORMAT_UYVY; |
259 if (capabilities.texture_rg) | 262 if (capabilities.texture_rg) |
260 return media::PIXEL_FORMAT_I420; | 263 return media::PIXEL_FORMAT_I420; |
261 return media::PIXEL_FORMAT_UNKNOWN; | 264 return media::PIXEL_FORMAT_UNKNOWN; |
262 } | 265 } |
263 | 266 |
264 namespace { | 267 namespace { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 context_provider_refptr_ = nullptr; | 319 context_provider_refptr_ = nullptr; |
317 } | 320 } |
318 | 321 |
319 scoped_refptr<ContextProviderCommandBuffer> | 322 scoped_refptr<ContextProviderCommandBuffer> |
320 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { | 323 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { |
321 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 324 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
322 return context_provider_refptr_; | 325 return context_provider_refptr_; |
323 } | 326 } |
324 | 327 |
325 } // namespace content | 328 } // namespace content |
OLD | NEW |