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

Side by Side Diff: content/common/gpu/media/gpu_video_decode_accelerator.h

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gn libs defs 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 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/shared_memory.h" 16 #include "base/memory/shared_memory.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "content/common/gpu/gpu_command_buffer_stub.h"
19 #include "gpu/command_buffer/service/texture_manager.h" 18 #include "gpu/command_buffer/service/texture_manager.h"
20 #include "gpu/config/gpu_info.h" 19 #include "gpu/config/gpu_info.h"
20 #include "gpu/ipc/service/gpu_command_buffer_stub.h"
21 #include "ipc/ipc_listener.h" 21 #include "ipc/ipc_listener.h"
22 #include "ipc/ipc_sender.h" 22 #include "ipc/ipc_sender.h"
23 #include "media/video/video_decode_accelerator.h" 23 #include "media/video/video_decode_accelerator.h"
24 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
25 25
26 namespace gpu { 26 namespace gpu {
27 struct GpuPreferences; 27 struct GpuPreferences;
28 } // namespace gpu 28 } // namespace gpu
29 29
30 namespace content { 30 namespace content {
31 31
32 class GpuVideoDecodeAccelerator 32 class GpuVideoDecodeAccelerator
33 : public IPC::Listener, 33 : public IPC::Listener,
34 public IPC::Sender, 34 public IPC::Sender,
35 public media::VideoDecodeAccelerator::Client, 35 public media::VideoDecodeAccelerator::Client,
36 public GpuCommandBufferStub::DestructionObserver { 36 public gpu::GpuCommandBufferStub::DestructionObserver {
37 public: 37 public:
38 // Each of the arguments to the constructor must outlive this object. 38 // Each of the arguments to the constructor must outlive this object.
39 // |stub->decoder()| will be made current around any operation that touches 39 // |stub->decoder()| will be made current around any operation that touches
40 // the underlying VDA so that it can make GL calls safely. 40 // the underlying VDA so that it can make GL calls safely.
41 GpuVideoDecodeAccelerator( 41 GpuVideoDecodeAccelerator(
42 int32_t host_route_id, 42 int32_t host_route_id,
43 GpuCommandBufferStub* stub, 43 gpu::GpuCommandBufferStub* stub,
44 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); 44 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
45 45
46 // Static query for the capabilities, which includes the supported profiles. 46 // Static query for the capabilities, which includes the supported profiles.
47 // This query calls the appropriate platform-specific version. The returned 47 // This query calls the appropriate platform-specific version. The returned
48 // capabilities will not contain duplicate supported profile entries. 48 // capabilities will not contain duplicate supported profile entries.
49 static gpu::VideoDecodeAcceleratorCapabilities GetCapabilities( 49 static gpu::VideoDecodeAcceleratorCapabilities GetCapabilities(
50 const gpu::GpuPreferences& gpu_preferences); 50 const gpu::GpuPreferences& gpu_preferences);
51 51
52 // IPC::Listener implementation. 52 // IPC::Listener implementation.
53 bool OnMessageReceived(const IPC::Message& message) override; 53 bool OnMessageReceived(const IPC::Message& message) override;
(...skipping 11 matching lines...) Expand all
65 void NotifyError(media::VideoDecodeAccelerator::Error error) override; 65 void NotifyError(media::VideoDecodeAccelerator::Error error) override;
66 66
67 // GpuCommandBufferStub::DestructionObserver implementation. 67 // GpuCommandBufferStub::DestructionObserver implementation.
68 void OnWillDestroyStub() override; 68 void OnWillDestroyStub() override;
69 69
70 // Function to delegate sending to actual sender. 70 // Function to delegate sending to actual sender.
71 bool Send(IPC::Message* message) override; 71 bool Send(IPC::Message* message) override;
72 72
73 // Initialize VDAs from the set of VDAs supported for current platform until 73 // Initialize VDAs from the set of VDAs supported for current platform until
74 // one of them succeeds for given |config|. Send the |init_done_msg| when 74 // one of them succeeds for given |config|. Send the |init_done_msg| when
75 // done. filter_ is passed to GpuCommandBufferStub channel only if the chosen 75 // done. filter_ is passed to gpu::GpuCommandBufferStub channel only if the
76 // VDA can decode on IO thread. 76 // chosen VDA can decode on IO thread.
77 bool Initialize(const media::VideoDecodeAccelerator::Config& config); 77 bool Initialize(const media::VideoDecodeAccelerator::Config& config);
78 78
79 private: 79 private:
80 typedef scoped_ptr<media::VideoDecodeAccelerator> ( 80 typedef scoped_ptr<media::VideoDecodeAccelerator> (
81 GpuVideoDecodeAccelerator::*CreateVDAFp)(); 81 GpuVideoDecodeAccelerator::*CreateVDAFp)();
82 82
83 class MessageFilter; 83 class MessageFilter;
84 84
85 #if defined(OS_WIN) 85 #if defined(OS_WIN)
86 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA(); 86 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX) 124 #if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX)
125 // Helper to bind |image| to the texture specified by |client_texture_id|. 125 // Helper to bind |image| to the texture specified by |client_texture_id|.
126 void BindImage(uint32_t client_texture_id, 126 void BindImage(uint32_t client_texture_id,
127 uint32_t texture_target, 127 uint32_t texture_target,
128 scoped_refptr<gl::GLImage> image); 128 scoped_refptr<gl::GLImage> image);
129 #endif 129 #endif
130 130
131 // Route ID to communicate with the host. 131 // Route ID to communicate with the host.
132 const int32_t host_route_id_; 132 const int32_t host_route_id_;
133 133
134 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is 134 // Unowned pointer to the underlying gpu::GpuCommandBufferStub. |this| is
135 // registered as a DestuctionObserver of |stub_| and will self-delete when 135 // registered as a DestuctionObserver of |stub_| and will self-delete when
136 // |stub_| is destroyed. 136 // |stub_| is destroyed.
137 GpuCommandBufferStub* const stub_; 137 gpu::GpuCommandBufferStub* const stub_;
138 138
139 // The underlying VideoDecodeAccelerator. 139 // The underlying VideoDecodeAccelerator.
140 scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_; 140 scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_;
141 141
142 // Callback for making the relevant context current for GL calls. 142 // Callback for making the relevant context current for GL calls.
143 // Returns false if failed. 143 // Returns false if failed.
144 base::Callback<bool(void)> make_context_current_; 144 base::Callback<bool(void)> make_context_current_;
145 145
146 // The texture dimensions as requested by ProvidePictureBuffers(). 146 // The texture dimensions as requested by ProvidePictureBuffers().
147 gfx::Size texture_dimensions_; 147 gfx::Size texture_dimensions_;
(...skipping 24 matching lines...) Expand all
172 172
173 // A map from picture buffer ID to TextureRef that have not been cleared. 173 // A map from picture buffer ID to TextureRef that have not been cleared.
174 std::map<int32_t, scoped_refptr<gpu::gles2::TextureRef>> uncleared_textures_; 174 std::map<int32_t, scoped_refptr<gpu::gles2::TextureRef>> uncleared_textures_;
175 175
176 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); 176 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator);
177 }; 177 };
178 178
179 } // namespace content 179 } // namespace content
180 180
181 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 181 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698