| OLD | NEW |
| 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 "content/common/gpu/media/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 | 17 |
| 18 #include "content/common/gpu/gpu_channel.h" |
| 19 #include "content/common/gpu/gpu_channel_manager.h" |
| 18 #include "content/common/gpu/media/gpu_video_accelerator_util.h" | 20 #include "content/common/gpu/media/gpu_video_accelerator_util.h" |
| 19 #include "gpu/command_buffer/common/command_buffer.h" | 21 #include "gpu/command_buffer/common/command_buffer.h" |
| 20 #include "gpu/command_buffer/service/gpu_preferences.h" | 22 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 21 #include "gpu/ipc/service/gpu_channel.h" | |
| 22 #include "gpu/ipc/service/gpu_channel_manager.h" | |
| 23 #include "ipc/ipc_message_macros.h" | 23 #include "ipc/ipc_message_macros.h" |
| 24 #include "ipc/ipc_message_utils.h" | 24 #include "ipc/ipc_message_utils.h" |
| 25 #include "ipc/message_filter.h" | 25 #include "ipc/message_filter.h" |
| 26 #include "media/base/limits.h" | 26 #include "media/base/limits.h" |
| 27 #include "media/gpu/ipc/common/media_messages.h" | 27 #include "media/gpu/ipc/common/media_messages.h" |
| 28 #include "ui/gl/gl_context.h" | 28 #include "ui/gl/gl_context.h" |
| 29 #include "ui/gl/gl_image.h" | 29 #include "ui/gl/gl_image.h" |
| 30 #include "ui/gl/gl_surface_egl.h" | 30 #include "ui/gl/gl_surface_egl.h" |
| 31 | 31 |
| 32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 46 #endif | 46 #endif |
| 47 #elif defined(OS_ANDROID) | 47 #elif defined(OS_ANDROID) |
| 48 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 48 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #include "ui/gfx/geometry/size.h" | 51 #include "ui/gfx/geometry/size.h" |
| 52 | 52 |
| 53 namespace content { | 53 namespace content { |
| 54 | 54 |
| 55 static bool MakeDecoderContextCurrent( | 55 static bool MakeDecoderContextCurrent( |
| 56 const base::WeakPtr<gpu::GpuCommandBufferStub> stub) { | 56 const base::WeakPtr<GpuCommandBufferStub> stub) { |
| 57 if (!stub) { | 57 if (!stub) { |
| 58 DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; | 58 DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 | 61 |
| 62 if (!stub->decoder()->MakeCurrent()) { | 62 if (!stub->decoder()->MakeCurrent()) { |
| 63 DLOG(ERROR) << "Failed to MakeCurrent()"; | 63 DLOG(ERROR) << "Failed to MakeCurrent()"; |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 GpuVideoDecodeAccelerator* const owner_; | 122 GpuVideoDecodeAccelerator* const owner_; |
| 123 const int32_t host_route_id_; | 123 const int32_t host_route_id_; |
| 124 // The sender to which this filter was added. | 124 // The sender to which this filter was added. |
| 125 IPC::Sender* sender_; | 125 IPC::Sender* sender_; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( | 128 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( |
| 129 int32_t host_route_id, | 129 int32_t host_route_id, |
| 130 gpu::GpuCommandBufferStub* stub, | 130 GpuCommandBufferStub* stub, |
| 131 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) | 131 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
| 132 : host_route_id_(host_route_id), | 132 : host_route_id_(host_route_id), |
| 133 stub_(stub), | 133 stub_(stub), |
| 134 texture_target_(0), | 134 texture_target_(0), |
| 135 textures_per_buffer_(0), | 135 textures_per_buffer_(0), |
| 136 filter_removed_(true, false), | 136 filter_removed_(true, false), |
| 137 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 137 child_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 138 io_task_runner_(io_task_runner), | 138 io_task_runner_(io_task_runner), |
| 139 weak_factory_for_io_(this) { | 139 weak_factory_for_io_(this) { |
| 140 DCHECK(stub_); | 140 DCHECK(stub_); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second; | 625 scoped_refptr<gpu::gles2::TextureRef> texture_ref = it->second; |
| 626 GLenum target = texture_ref->texture()->target(); | 626 GLenum target = texture_ref->texture()->target(); |
| 627 gpu::gles2::TextureManager* texture_manager = | 627 gpu::gles2::TextureManager* texture_manager = |
| 628 stub_->decoder()->GetContextGroup()->texture_manager(); | 628 stub_->decoder()->GetContextGroup()->texture_manager(); |
| 629 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); | 629 DCHECK(!texture_ref->texture()->IsLevelCleared(target, 0)); |
| 630 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); | 630 texture_manager->SetLevelCleared(texture_ref.get(), target, 0, true); |
| 631 uncleared_textures_.erase(it); | 631 uncleared_textures_.erase(it); |
| 632 } | 632 } |
| 633 | 633 |
| 634 } // namespace content | 634 } // namespace content |
| OLD | NEW |