Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: content/renderer/media/renderer_gpu_video_accelerator_factories.cc

Issue 2120713002: Fix use_image_texture_target inconsistencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } // namespace 43 } // namespace
44 44
45 // static 45 // static
46 std::unique_ptr<RendererGpuVideoAcceleratorFactories> 46 std::unique_ptr<RendererGpuVideoAcceleratorFactories>
47 RendererGpuVideoAcceleratorFactories::Create( 47 RendererGpuVideoAcceleratorFactories::Create(
48 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, 48 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
49 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner, 49 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner,
50 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 50 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
51 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 51 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
52 bool enable_gpu_memory_buffer_video_frames, 52 bool enable_gpu_memory_buffer_video_frames,
53 std::vector<unsigned> image_texture_targets, 53 const cc::RendererSettings::ImageTextureTargetsMap& image_texture_targets,
54 bool enable_video_accelerator) { 54 bool enable_video_accelerator) {
55 RecordContextProviderPhaseUmaEnum( 55 RecordContextProviderPhaseUmaEnum(
56 ContextProviderPhase::CONTEXT_PROVIDER_ACQUIRED); 56 ContextProviderPhase::CONTEXT_PROVIDER_ACQUIRED);
57 return base::WrapUnique(new RendererGpuVideoAcceleratorFactories( 57 return base::WrapUnique(new RendererGpuVideoAcceleratorFactories(
58 std::move(gpu_channel_host), main_thread_task_runner, task_runner, 58 std::move(gpu_channel_host), main_thread_task_runner, task_runner,
59 context_provider, enable_gpu_memory_buffer_video_frames, 59 context_provider, enable_gpu_memory_buffer_video_frames,
60 image_texture_targets, enable_video_accelerator)); 60 image_texture_targets, enable_video_accelerator));
61 } 61 }
62 62
63 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories( 63 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories(
64 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, 64 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
65 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner, 65 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner,
66 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 66 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
67 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 67 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
68 bool enable_gpu_memory_buffer_video_frames, 68 bool enable_gpu_memory_buffer_video_frames,
69 std::vector<unsigned> image_texture_targets, 69 const cc::RendererSettings::ImageTextureTargetsMap& image_texture_targets,
70 bool enable_video_accelerator) 70 bool enable_video_accelerator)
71 : main_thread_task_runner_(main_thread_task_runner), 71 : main_thread_task_runner_(main_thread_task_runner),
72 task_runner_(task_runner), 72 task_runner_(task_runner),
73 gpu_channel_host_(std::move(gpu_channel_host)), 73 gpu_channel_host_(std::move(gpu_channel_host)),
74 context_provider_refptr_(context_provider), 74 context_provider_refptr_(context_provider),
75 context_provider_(context_provider.get()), 75 context_provider_(context_provider.get()),
76 enable_gpu_memory_buffer_video_frames_( 76 enable_gpu_memory_buffer_video_frames_(
77 enable_gpu_memory_buffer_video_frames), 77 enable_gpu_memory_buffer_video_frames),
78 image_texture_targets_(image_texture_targets), 78 image_texture_targets_(image_texture_targets),
79 video_accelerator_enabled_(enable_video_accelerator), 79 video_accelerator_enabled_(enable_video_accelerator),
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 size, format, usage, gpu::kNullSurfaceHandle); 222 size, format, usage, gpu::kNullSurfaceHandle);
223 return buffer; 223 return buffer;
224 } 224 }
225 bool RendererGpuVideoAcceleratorFactories:: 225 bool RendererGpuVideoAcceleratorFactories::
226 ShouldUseGpuMemoryBuffersForVideoFrames() const { 226 ShouldUseGpuMemoryBuffersForVideoFrames() const {
227 return enable_gpu_memory_buffer_video_frames_; 227 return enable_gpu_memory_buffer_video_frames_;
228 } 228 }
229 229
230 unsigned RendererGpuVideoAcceleratorFactories::ImageTextureTarget( 230 unsigned RendererGpuVideoAcceleratorFactories::ImageTextureTarget(
231 gfx::BufferFormat format) { 231 gfx::BufferFormat format) {
232 return image_texture_targets_[static_cast<int>(format)]; 232 auto found =
233 image_texture_targets_.find(cc::RendererSettings::ImageTextureTargetKey(
234 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, format));
235 DCHECK(found != image_texture_targets_.end());
236 return found->second;
233 } 237 }
234 238
235 media::VideoPixelFormat 239 media::VideoPixelFormat
236 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() { 240 RendererGpuVideoAcceleratorFactories::VideoFrameOutputFormat() {
237 DCHECK(task_runner_->BelongsToCurrentThread()); 241 DCHECK(task_runner_->BelongsToCurrentThread());
238 if (CheckContextLost()) 242 if (CheckContextLost())
239 return media::PIXEL_FORMAT_UNKNOWN; 243 return media::PIXEL_FORMAT_UNKNOWN;
240 cc::ContextProvider::ScopedContextLock lock(context_provider_); 244 cc::ContextProvider::ScopedContextLock lock(context_provider_);
241 auto capabilities = context_provider_->ContextCapabilities(); 245 auto capabilities = context_provider_->ContextCapabilities();
242 if (capabilities.image_ycbcr_420v) 246 if (capabilities.image_ycbcr_420v)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 context_provider_refptr_ = nullptr; 307 context_provider_refptr_ = nullptr;
304 } 308 }
305 309
306 scoped_refptr<ContextProviderCommandBuffer> 310 scoped_refptr<ContextProviderCommandBuffer>
307 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() { 311 RendererGpuVideoAcceleratorFactories::ContextProviderMainThread() {
308 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 312 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
309 return context_provider_refptr_; 313 return context_provider_refptr_;
310 } 314 }
311 315
312 } // namespace content 316 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698