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

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

Issue 1882373004: Migrate content/common/gpu/media code to media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix several more bot-identified build issues Created 4 years, 8 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 "content/common/gpu/media/gpu_video_decode_accelerator.h" 5 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "content/common/gpu/media/gpu_video_decode_accelerator_factory_impl.h"
18 #include "gpu/command_buffer/common/command_buffer.h" 17 #include "gpu/command_buffer/common/command_buffer.h"
19 #include "gpu/command_buffer/service/gpu_preferences.h" 18 #include "gpu/command_buffer/service/gpu_preferences.h"
20 #include "gpu/ipc/service/gpu_channel.h" 19 #include "gpu/ipc/service/gpu_channel.h"
21 #include "gpu/ipc/service/gpu_channel_manager.h" 20 #include "gpu/ipc/service/gpu_channel_manager.h"
22 #include "ipc/ipc_message_macros.h" 21 #include "ipc/ipc_message_macros.h"
23 #include "ipc/ipc_message_utils.h" 22 #include "ipc/ipc_message_utils.h"
24 #include "ipc/message_filter.h" 23 #include "ipc/message_filter.h"
25 #include "media/base/limits.h" 24 #include "media/base/limits.h"
26 #include "media/gpu/ipc/common/gpu_video_accelerator_util.h" 25 #include "media/gpu/ipc/common/gpu_video_accelerator_util.h"
27 #include "media/gpu/ipc/common/media_messages.h" 26 #include "media/gpu/ipc/common/media_messages.h"
27 #include "media/gpu/ipc/service/gpu_video_decode_accelerator_factory_impl.h"
28 #include "ui/gfx/geometry/size.h" 28 #include "ui/gfx/geometry/size.h"
29 #include "ui/gl/gl_context.h" 29 #include "ui/gl/gl_context.h"
30 #include "ui/gl/gl_image.h" 30 #include "ui/gl/gl_image.h"
31 31
32 namespace content { 32 namespace media {
33 33
34 namespace { 34 namespace {
35 static gfx::GLContext* GetGLContext( 35 static gfx::GLContext* GetGLContext(
36 const base::WeakPtr<gpu::GpuCommandBufferStub>& stub) { 36 const base::WeakPtr<gpu::GpuCommandBufferStub>& stub) {
37 if (!stub) { 37 if (!stub) {
38 DLOG(ERROR) << "Stub is gone; no GLContext."; 38 DLOG(ERROR) << "Stub is gone; no GLContext.";
39 return nullptr; 39 return nullptr;
40 } 40 }
41 41
42 return stub->decoder()->GetGLContext(); 42 return stub->decoder()->GetGLContext();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // Notify client that picture buffer is now unused. 243 // Notify client that picture buffer is now unused.
244 if (!Send(new AcceleratedVideoDecoderHostMsg_DismissPictureBuffer( 244 if (!Send(new AcceleratedVideoDecoderHostMsg_DismissPictureBuffer(
245 host_route_id_, picture_buffer_id))) { 245 host_route_id_, picture_buffer_id))) {
246 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer) " 246 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer) "
247 << "failed"; 247 << "failed";
248 } 248 }
249 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); 249 DebugAutoLock auto_lock(debug_uncleared_textures_lock_);
250 uncleared_textures_.erase(picture_buffer_id); 250 uncleared_textures_.erase(picture_buffer_id);
251 } 251 }
252 252
253 void GpuVideoDecodeAccelerator::PictureReady( 253 void GpuVideoDecodeAccelerator::PictureReady(const media::Picture& picture) {
254 const media::Picture& picture) {
255 // VDA may call PictureReady on IO thread. SetTextureCleared should run on 254 // VDA may call PictureReady on IO thread. SetTextureCleared should run on
256 // the child thread. VDA is responsible to call PictureReady on the child 255 // the child thread. VDA is responsible to call PictureReady on the child
257 // thread when a picture buffer is delivered the first time. 256 // thread when a picture buffer is delivered the first time.
258 if (child_task_runner_->BelongsToCurrentThread()) { 257 if (child_task_runner_->BelongsToCurrentThread()) {
259 SetTextureCleared(picture); 258 SetTextureCleared(picture);
260 } else { 259 } else {
261 DCHECK(io_task_runner_->BelongsToCurrentThread()); 260 DCHECK(io_task_runner_->BelongsToCurrentThread());
262 DebugAutoLock auto_lock(debug_uncleared_textures_lock_); 261 DebugAutoLock auto_lock(debug_uncleared_textures_lock_);
263 DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id())); 262 DCHECK_EQ(0u, uncleared_textures_.count(picture.picture_buffer_id()));
264 } 263 }
(...skipping 21 matching lines...) Expand all
286 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed"; 285 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed";
287 } 286 }
288 287
289 void GpuVideoDecodeAccelerator::NotifyResetDone() { 288 void GpuVideoDecodeAccelerator::NotifyResetDone() {
290 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) 289 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
291 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; 290 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
292 } 291 }
293 292
294 void GpuVideoDecodeAccelerator::NotifyError( 293 void GpuVideoDecodeAccelerator::NotifyError(
295 media::VideoDecodeAccelerator::Error error) { 294 media::VideoDecodeAccelerator::Error error) {
296 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification( 295 if (!Send(new AcceleratedVideoDecoderHostMsg_ErrorNotification(host_route_id_,
297 host_route_id_, error))) { 296 error))) {
298 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) " 297 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ErrorNotification) "
299 << "failed"; 298 << "failed";
300 } 299 }
301 } 300 }
302 301
303 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { 302 void GpuVideoDecodeAccelerator::OnWillDestroyStub() {
304 // The stub is going away, so we have to stop and destroy VDA here, before 303 // The stub is going away, so we have to stop and destroy VDA here, before
305 // returning, because the VDA may need the GL context to run and/or do its 304 // returning, because the VDA may need the GL context to run and/or do its
306 // cleanup. We cannot destroy the VDA before the IO thread message filter is 305 // cleanup. We cannot destroy the VDA before the IO thread message filter is
307 // removed however, since we cannot service incoming messages with VDA gone. 306 // removed however, since we cannot service incoming messages with VDA gone.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 for (auto texture_ref : it->second) { 513 for (auto texture_ref : it->second) {
515 GLenum target = texture_ref->texture()->target(); 514 GLenum target = texture_ref->texture()->target();
516 gpu::gles2::TextureManager* texture_manager = 515 gpu::gles2::TextureManager* texture_manager =
517 stub_->decoder()->GetContextGroup()->texture_manager(); 516 stub_->decoder()->GetContextGroup()->texture_manager();
518 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); 517 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0));
519 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); 518 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true);
520 } 519 }
521 uncleared_textures_.erase(it); 520 uncleared_textures_.erase(it);
522 } 521 }
523 522
524 } // namespace content 523 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698