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

Side by Side Diff: media/gpu/ipc/service/gpu_video_decode_accelerator.cc

Issue 2864603002: Provide callback to create mojo AndroidOverlays to AVDA. (Closed)
Patch Set: rebased Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/gpu/ipc/service/gpu_video_decode_accelerator.h" 5 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 private: 150 private:
151 GpuVideoDecodeAccelerator* const owner_; 151 GpuVideoDecodeAccelerator* const owner_;
152 const int32_t host_route_id_; 152 const int32_t host_route_id_;
153 // The sender to which this filter was added. 153 // The sender to which this filter was added.
154 IPC::Sender* sender_; 154 IPC::Sender* sender_;
155 }; 155 };
156 156
157 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( 157 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
158 int32_t host_route_id, 158 int32_t host_route_id,
159 gpu::GpuCommandBufferStub* stub, 159 gpu::GpuCommandBufferStub* stub,
160 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) 160 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
161 const AndroidOverlayMojoFactoryCB& overlay_factory_cb)
161 : host_route_id_(host_route_id), 162 : host_route_id_(host_route_id),
162 stub_(stub), 163 stub_(stub),
163 texture_target_(0), 164 texture_target_(0),
164 textures_per_buffer_(0), 165 textures_per_buffer_(0),
165 filter_removed_(base::WaitableEvent::ResetPolicy::MANUAL, 166 filter_removed_(base::WaitableEvent::ResetPolicy::MANUAL,
166 base::WaitableEvent::InitialState::NOT_SIGNALED), 167 base::WaitableEvent::InitialState::NOT_SIGNALED),
167 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), 168 child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
168 io_task_runner_(io_task_runner), 169 io_task_runner_(io_task_runner),
170 overlay_factory_cb_(overlay_factory_cb),
169 weak_factory_for_io_(this) { 171 weak_factory_for_io_(this) {
170 DCHECK(stub_); 172 DCHECK(stub_);
171 stub_->AddDestructionObserver(this); 173 stub_->AddDestructionObserver(this);
172 get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr()); 174 get_gl_context_cb_ = base::Bind(&GetGLContext, stub_->AsWeakPtr());
173 make_context_current_cb_ = 175 make_context_current_cb_ =
174 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); 176 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr());
175 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || \ 177 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || \
176 defined(OS_MACOSX) || defined(OS_WIN) 178 defined(OS_MACOSX) || defined(OS_WIN)
177 bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr()); 179 bind_image_cb_ = base::Bind(&BindImage, stub_->AsWeakPtr());
178 #endif 180 #endif
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 #if !defined(OS_WIN) 354 #if !defined(OS_WIN)
353 // Ensure we will be able to get a GL context at all before initializing 355 // Ensure we will be able to get a GL context at all before initializing
354 // non-Windows VDAs. 356 // non-Windows VDAs.
355 if (!make_context_current_cb_.Run()) 357 if (!make_context_current_cb_.Run())
356 return false; 358 return false;
357 #endif 359 #endif
358 360
359 std::unique_ptr<GpuVideoDecodeAcceleratorFactory> vda_factory = 361 std::unique_ptr<GpuVideoDecodeAcceleratorFactory> vda_factory =
360 GpuVideoDecodeAcceleratorFactory::CreateWithGLES2Decoder( 362 GpuVideoDecodeAcceleratorFactory::CreateWithGLES2Decoder(
361 get_gl_context_cb_, make_context_current_cb_, bind_image_cb_, 363 get_gl_context_cb_, make_context_current_cb_, bind_image_cb_,
362 get_gles2_decoder_cb_); 364 get_gles2_decoder_cb_, overlay_factory_cb_);
363 365
364 if (!vda_factory) { 366 if (!vda_factory) {
365 LOG(ERROR) << "Failed creating the VDA factory"; 367 LOG(ERROR) << "Failed creating the VDA factory";
366 return false; 368 return false;
367 } 369 }
368 370
369 const gpu::GpuDriverBugWorkarounds& gpu_workarounds = 371 const gpu::GpuDriverBugWorkarounds& gpu_workarounds =
370 stub_->channel()->gpu_channel_manager()->gpu_driver_bug_workarounds(); 372 stub_->channel()->gpu_channel_manager()->gpu_driver_bug_workarounds();
371 const gpu::GpuPreferences& gpu_preferences = 373 const gpu::GpuPreferences& gpu_preferences =
372 stub_->channel()->gpu_channel_manager()->gpu_preferences(); 374 stub_->channel()->gpu_channel_manager()->gpu_preferences();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 for (auto texture_ref : it->second) { 533 for (auto texture_ref : it->second) {
532 GLenum target = texture_ref->texture()->target(); 534 GLenum target = texture_ref->texture()->target();
533 gpu::gles2::TextureManager* texture_manager = 535 gpu::gles2::TextureManager* texture_manager =
534 stub_->decoder()->GetContextGroup()->texture_manager(); 536 stub_->decoder()->GetContextGroup()->texture_manager();
535 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); 537 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true);
536 } 538 }
537 uncleared_textures_.erase(it); 539 uncleared_textures_.erase(it);
538 } 540 }
539 541
540 } // namespace media 542 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/ipc/service/gpu_video_decode_accelerator.h ('k') | media/gpu/ipc/service/media_gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698