| 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 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
| 24 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" | 24 #include "media/gpu/gpu_video_decode_accelerator_helpers.h" |
| 25 #include "media/video/video_decode_accelerator.h" | 25 #include "media/video/video_decode_accelerator.h" |
| 26 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
| 27 | 27 |
| 28 namespace gpu { | 28 namespace gpu { |
| 29 class GpuDriverBugWorkarounds; | 29 class GpuDriverBugWorkarounds; |
| 30 struct GpuPreferences; | 30 struct GpuPreferences; |
| 31 } // namespace gpu | 31 } // namespace gpu |
| 32 | 32 |
| 33 namespace service_manager { |
| 34 class Connector; |
| 35 } // namespace service_manager |
| 36 |
| 33 namespace media { | 37 namespace media { |
| 34 | 38 |
| 35 class GpuVideoDecodeAccelerator | 39 class GpuVideoDecodeAccelerator |
| 36 : public IPC::Listener, | 40 : public IPC::Listener, |
| 37 public IPC::Sender, | 41 public IPC::Sender, |
| 38 public VideoDecodeAccelerator::Client, | 42 public VideoDecodeAccelerator::Client, |
| 39 public gpu::GpuCommandBufferStub::DestructionObserver { | 43 public gpu::GpuCommandBufferStub::DestructionObserver { |
| 40 public: | 44 public: |
| 41 // Each of the arguments to the constructor must outlive this object. | 45 // Each of the arguments to the constructor must outlive this object. |
| 42 // |stub->decoder()| will be made current around any operation that touches | 46 // |stub->decoder()| will be made current around any operation that touches |
| 43 // the underlying VDA so that it can make GL calls safely. | 47 // the underlying VDA so that it can make GL calls safely. |
| 44 GpuVideoDecodeAccelerator( | 48 GpuVideoDecodeAccelerator( |
| 45 int32_t host_route_id, | 49 int32_t host_route_id, |
| 46 gpu::GpuCommandBufferStub* stub, | 50 gpu::GpuCommandBufferStub* stub, |
| 47 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 51 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 52 service_manager::Connector* connector, |
| 53 const char* browser_service_name); |
| 48 | 54 |
| 49 // Static query for the capabilities, which includes the supported profiles. | 55 // Static query for the capabilities, which includes the supported profiles. |
| 50 // This query calls the appropriate platform-specific version. The returned | 56 // This query calls the appropriate platform-specific version. The returned |
| 51 // capabilities will not contain duplicate supported profile entries. | 57 // capabilities will not contain duplicate supported profile entries. |
| 52 static gpu::VideoDecodeAcceleratorCapabilities GetCapabilities( | 58 static gpu::VideoDecodeAcceleratorCapabilities GetCapabilities( |
| 53 const gpu::GpuPreferences& gpu_preferences, | 59 const gpu::GpuPreferences& gpu_preferences, |
| 54 const gpu::GpuDriverBugWorkarounds& workarounds); | 60 const gpu::GpuDriverBugWorkarounds& workarounds); |
| 55 | 61 |
| 56 // IPC::Listener implementation. | 62 // IPC::Listener implementation. |
| 57 bool OnMessageReceived(const IPC::Message& message) override; | 63 bool OnMessageReceived(const IPC::Message& message) override; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Used to wait on for |filter_| to be removed, before we can safely | 150 // Used to wait on for |filter_| to be removed, before we can safely |
| 145 // destroy the VDA. | 151 // destroy the VDA. |
| 146 base::WaitableEvent filter_removed_; | 152 base::WaitableEvent filter_removed_; |
| 147 | 153 |
| 148 // GPU child thread task runner. | 154 // GPU child thread task runner. |
| 149 const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; | 155 const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; |
| 150 | 156 |
| 151 // GPU IO thread task runner. | 157 // GPU IO thread task runner. |
| 152 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 158 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 153 | 159 |
| 160 // Optional mojo connector and the name of the browser service. |
| 161 service_manager::Connector* connector_ = nullptr; |
| 162 const char* browser_service_name_ = nullptr; |
| 163 |
| 154 // Weak pointers will be invalidated on IO thread. | 164 // Weak pointers will be invalidated on IO thread. |
| 155 base::WeakPtrFactory<Client> weak_factory_for_io_; | 165 base::WeakPtrFactory<Client> weak_factory_for_io_; |
| 156 | 166 |
| 157 // Protects |uncleared_textures_| when DCHECK is on. This is for debugging | 167 // Protects |uncleared_textures_| when DCHECK is on. This is for debugging |
| 158 // only. We don't want to hold a lock on IO thread. When DCHECK is off, | 168 // only. We don't want to hold a lock on IO thread. When DCHECK is off, |
| 159 // |uncleared_textures_| is only accessed from the child thread. | 169 // |uncleared_textures_| is only accessed from the child thread. |
| 160 base::Lock debug_uncleared_textures_lock_; | 170 base::Lock debug_uncleared_textures_lock_; |
| 161 | 171 |
| 162 // A map from picture buffer ID to set of TextureRefs that have not been | 172 // A map from picture buffer ID to set of TextureRefs that have not been |
| 163 // cleared. | 173 // cleared. |
| 164 std::map<int32_t, std::vector<scoped_refptr<gpu::gles2::TextureRef>>> | 174 std::map<int32_t, std::vector<scoped_refptr<gpu::gles2::TextureRef>>> |
| 165 uncleared_textures_; | 175 uncleared_textures_; |
| 166 | 176 |
| 167 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 177 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
| 168 }; | 178 }; |
| 169 | 179 |
| 170 } // namespace media | 180 } // namespace media |
| 171 | 181 |
| 172 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 182 #endif // MEDIA_GPU_IPC_SERVICE_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |