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

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

Issue 1745903002: Introduce GpuVideoDecodeAcceleratorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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" 18 #include "content/common/gpu/gpu_command_buffer_stub.h"
19 #include "content/public/common/gpu_video_decode_accelerator_helpers.h"
19 #include "gpu/command_buffer/service/texture_manager.h" 20 #include "gpu/command_buffer/service/texture_manager.h"
20 #include "gpu/config/gpu_info.h" 21 #include "gpu/config/gpu_info.h"
21 #include "ipc/ipc_listener.h" 22 #include "ipc/ipc_listener.h"
22 #include "ipc/ipc_sender.h" 23 #include "ipc/ipc_sender.h"
23 #include "media/video/video_decode_accelerator.h" 24 #include "media/video/video_decode_accelerator.h"
24 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
25 26
26 struct AcceleratedVideoDecoderMsg_Decode_Params; 27 struct AcceleratedVideoDecoderMsg_Decode_Params;
27 28
28 namespace content { 29 namespace content {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 bool Send(IPC::Message* message) override; 69 bool Send(IPC::Message* message) override;
69 70
70 // Initialize VDAs from the set of VDAs supported for current platform until 71 // Initialize VDAs from the set of VDAs supported for current platform until
71 // one of them succeeds for given |config|. Send the |init_done_msg| when 72 // one of them succeeds for given |config|. Send the |init_done_msg| when
72 // done. filter_ is passed to GpuCommandBufferStub channel only if the chosen 73 // done. filter_ is passed to GpuCommandBufferStub channel only if the chosen
73 // VDA can decode on IO thread. 74 // VDA can decode on IO thread.
74 void Initialize(const media::VideoDecodeAccelerator::Config& config, 75 void Initialize(const media::VideoDecodeAccelerator::Config& config,
75 IPC::Message* init_done_msg); 76 IPC::Message* init_done_msg);
76 77
77 private: 78 private:
78 typedef scoped_ptr<media::VideoDecodeAccelerator>(
79 GpuVideoDecodeAccelerator::*CreateVDAFp)();
80
81 class MessageFilter; 79 class MessageFilter;
82 80
83 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVAVDA();
84 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2VDA();
85 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2SliceVDA();
86 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiVDA();
87 scoped_ptr<media::VideoDecodeAccelerator> CreateVTVDA();
88 scoped_ptr<media::VideoDecodeAccelerator> CreateOzoneVDA();
89 scoped_ptr<media::VideoDecodeAccelerator> CreateAndroidVDA();
90
91 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. 81 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there.
92 ~GpuVideoDecodeAccelerator() override; 82 ~GpuVideoDecodeAccelerator() override;
93 83
94 // Handlers for IPC messages. 84 // Handlers for IPC messages.
95 void OnSetCdm(int cdm_id); 85 void OnSetCdm(int cdm_id);
96 void OnDecode(const AcceleratedVideoDecoderMsg_Decode_Params& params); 86 void OnDecode(const AcceleratedVideoDecoderMsg_Decode_Params& params);
97 void OnAssignPictureBuffers(const std::vector<int32_t>& buffer_ids, 87 void OnAssignPictureBuffers(const std::vector<int32_t>& buffer_ids,
98 const std::vector<uint32_t>& texture_ids); 88 const std::vector<uint32_t>& texture_ids);
99 void OnReusePictureBuffer(int32_t picture_buffer_id); 89 void OnReusePictureBuffer(int32_t picture_buffer_id);
100 void OnFlush(); 90 void OnFlush();
101 void OnReset(); 91 void OnReset();
102 void OnDestroy(); 92 void OnDestroy();
103 93
104 // Called on IO thread when |filter_| has been removed. 94 // Called on IO thread when |filter_| has been removed.
105 void OnFilterRemoved(); 95 void OnFilterRemoved();
106 96
107 // Sets the texture to cleared. 97 // Sets the texture to cleared.
108 void SetTextureCleared(const media::Picture& picture); 98 void SetTextureCleared(const media::Picture& picture);
109 99
110 // Helper for replying to the creation request. 100 // Helper for replying to the creation request.
111 void SendCreateDecoderReply(IPC::Message* message, bool succeeded); 101 void SendCreateDecoderReply(IPC::Message* message, bool succeeded);
112 102
113 // Helper to bind |image| to the texture specified by |client_texture_id|.
114 void BindImage(uint32_t client_texture_id,
115 uint32_t texture_target,
116 scoped_refptr<gl::GLImage> image);
117
118 // Route ID to communicate with the host. 103 // Route ID to communicate with the host.
119 const int32_t host_route_id_; 104 const int32_t host_route_id_;
120 105
121 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is 106 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is
122 // registered as a DestuctionObserver of |stub_| and will self-delete when 107 // registered as a DestuctionObserver of |stub_| and will self-delete when
123 // |stub_| is destroyed. 108 // |stub_| is destroyed.
124 GpuCommandBufferStub* const stub_; 109 GpuCommandBufferStub* const stub_;
125 110
126 // The underlying VideoDecodeAccelerator. 111 // The underlying VideoDecodeAccelerator.
127 scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_; 112 scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_;
128 113
114 // Callback to return current GLContext, if available.
115 gpu_vda_helpers::GetGLContextCb get_gl_context_cb_;
116
129 // Callback for making the relevant context current for GL calls. 117 // Callback for making the relevant context current for GL calls.
130 // Returns false if failed. 118 gpu_vda_helpers::MakeGLContextCurrentCb make_context_current_cb_;
131 base::Callback<bool(void)> make_context_current_; 119
120 // Callback to bind a GLImage to a given texture id and target.
121 gpu_vda_helpers::BindGLImageCb bind_image_cb_;
122
123 // Callback to return a WeakPtr to GLES2Decoder.
124 gpu_vda_helpers::GetGLES2DecoderCb get_gles2_decoder_cb_;
132 125
133 // The texture dimensions as requested by ProvidePictureBuffers(). 126 // The texture dimensions as requested by ProvidePictureBuffers().
134 gfx::Size texture_dimensions_; 127 gfx::Size texture_dimensions_;
135 128
136 // The texture target as requested by ProvidePictureBuffers(). 129 // The texture target as requested by ProvidePictureBuffers().
137 uint32_t texture_target_; 130 uint32_t texture_target_;
138 131
139 // The message filter to run VDA::Decode on IO thread if VDA supports it. 132 // The message filter to run VDA::Decode on IO thread if VDA supports it.
140 scoped_refptr<MessageFilter> filter_; 133 scoped_refptr<MessageFilter> filter_;
141 134
(...skipping 17 matching lines...) Expand all
159 152
160 // A map from picture buffer ID to TextureRef that have not been cleared. 153 // A map from picture buffer ID to TextureRef that have not been cleared.
161 std::map<int32_t, scoped_refptr<gpu::gles2::TextureRef>> uncleared_textures_; 154 std::map<int32_t, scoped_refptr<gpu::gles2::TextureRef>> uncleared_textures_;
162 155
163 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); 156 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator);
164 }; 157 };
165 158
166 } // namespace content 159 } // namespace content
167 160
168 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 161 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698