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

Side by Side Diff: media/video/video_decode_accelerator.h

Issue 1832123002: Revert of Introduce GpuVideoDecodeAcceleratorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « media/video/mock_video_decode_accelerator.h ('k') | media/video/video_decode_accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h"
15 #include "media/base/bitstream_buffer.h" 13 #include "media/base/bitstream_buffer.h"
16 #include "media/base/surface_manager.h" 14 #include "media/base/surface_manager.h"
17 #include "media/base/video_decoder_config.h" 15 #include "media/base/video_decoder_config.h"
18 #include "media/video/picture.h" 16 #include "media/video/picture.h"
19 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
18 #include "ui/gl/gl_image.h"
20 19
21 typedef unsigned int GLenum; 20 typedef unsigned int GLenum;
22 21
23 namespace base {
24 class SingleThreadTaskRunner;
25 }
26
27 namespace media { 22 namespace media {
28 23
29 // Video decoder interface. 24 // Video decoder interface.
30 // This interface is extended by the various components that ultimately 25 // This interface is extended by the various components that ultimately
31 // implement the backend of PPB_VideoDecoder_Dev. 26 // implement the backend of PPB_VideoDecoder_Dev.
32 class MEDIA_EXPORT VideoDecodeAccelerator { 27 class MEDIA_EXPORT VideoDecodeAccelerator {
33 public: 28 public:
34 // Specification of a decoding profile supported by an decoder. 29 // Specification of a decoding profile supported by an decoder.
35 // |max_resolution| and |min_resolution| are inclusive. 30 // |max_resolution| and |min_resolution| are inclusive.
36 struct MEDIA_EXPORT SupportedProfile { 31 struct MEDIA_EXPORT SupportedProfile {
37 SupportedProfile(); 32 SupportedProfile();
38 ~SupportedProfile(); 33 ~SupportedProfile();
39 VideoCodecProfile profile; 34 VideoCodecProfile profile;
40 gfx::Size max_resolution; 35 gfx::Size max_resolution;
41 gfx::Size min_resolution; 36 gfx::Size min_resolution;
42 bool encrypted_only; 37 bool encrypted_only;
43 }; 38 };
44 using SupportedProfiles = std::vector<SupportedProfile>; 39 using SupportedProfiles = std::vector<SupportedProfile>;
45 40
41 using MakeContextCurrentCallback = base::Callback<bool(void)>;
42 using BindImageCallback = base::Callback<
43 void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>, bool)>;
44
46 struct MEDIA_EXPORT Capabilities { 45 struct MEDIA_EXPORT Capabilities {
47 Capabilities(); 46 Capabilities();
48 Capabilities(const Capabilities& other); 47 Capabilities(const Capabilities& other);
49 ~Capabilities(); 48 ~Capabilities();
50 49
51 std::string AsHumanReadableString() const; 50 std::string AsHumanReadableString() const;
52 51
53 // Flags that can be associated with a VDA. 52 // Flags that can be associated with a VDA.
54 enum Flags { 53 enum Flags {
55 NO_FLAGS = 0, 54 NO_FLAGS = 0,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // "seek". 222 // "seek".
224 virtual void Reset() = 0; 223 virtual void Reset() = 0;
225 224
226 // Destroys the decoder: all pending inputs are dropped immediately and the 225 // Destroys the decoder: all pending inputs are dropped immediately and the
227 // component is freed. This call may asynchornously free system resources, 226 // component is freed. This call may asynchornously free system resources,
228 // but its client-visible effects are synchronous. After this method returns 227 // but its client-visible effects are synchronous. After this method returns
229 // no more callbacks will be made on the client. Deletes |this| 228 // no more callbacks will be made on the client. Deletes |this|
230 // unconditionally, so make sure to drop all pointers to it! 229 // unconditionally, so make sure to drop all pointers to it!
231 virtual void Destroy() = 0; 230 virtual void Destroy() = 0;
232 231
233 // TO BE CALLED IN THE SAME PROCESS AS THE VDA IMPLEMENTATION ONLY. 232 // GPU PROCESS ONLY. Implementations of this interface in the
234 // 233 // content/common/gpu/media should implement this, and implementations in
235 // A decode "task" is a sequence that includes a Decode() call from Client, 234 // other processes should not override the default implementation.
236 // as well as corresponding callbacks to return the input BitstreamBuffer 235 // Returns true if VDA::Decode and VDA::Client callbacks can run on the IO
237 // after use, and the resulting output Picture(s). 236 // thread. Otherwise they will run on the GPU child thread. The purpose of
238 // 237 // running Decode on the IO thread is to reduce decode latency. Note Decode
239 // If the Client can support running these three calls on a separate thread, 238 // should return as soon as possible and not block on the IO thread. Also,
240 // it may call this method to try to set up the VDA implementation to do so. 239 // PictureReady should be run on the child thread if a picture is delivered
241 // If the VDA can support this as well, return true, otherwise return false. 240 // the first time so it can be cleared.
242 // If true is returned, the client may submit each Decode() call (but no other 241 virtual bool CanDecodeOnIOThread();
243 // calls) on |decode_task_runner|, and should then expect that
244 // NotifyEndOfBitstreamBuffer() and PictureReady() callbacks may come on
245 // |decode_task_runner| as well, called on |decode_client|, instead of client
246 // provided to Initialize().
247 //
248 // This method may be called at any time.
249 //
250 // NOTE 1: some callbacks may still have to come on the main thread and the
251 // Client should handle both callbacks coming on main and |decode_task_runner|
252 // thread.
253 //
254 // NOTE 2: VDA implementations of Decode() must return as soon as possible and
255 // never block, as |decode_task_runner| may be a latency critical thread
256 // (such as the GPU IO thread).
257 //
258 // One application of this is offloading the GPU Child thread. In general,
259 // calls to VDA in GPU process have to be done on the GPU Child thread, as
260 // they may require GL context to be current. However, some VDAs may be able
261 // to run decode operations without GL context, which helps reduce latency and
262 // offloads the GPU Child thread.
263 virtual bool TryToSetupDecodeOnSeparateThread(
264 const base::WeakPtr<Client>& decode_client,
265 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner);
266 242
267 // Windows creates a BGRA texture. 243 // Windows creates a BGRA texture.
268 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 244 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691
269 virtual GLenum GetSurfaceInternalFormat() const; 245 virtual GLenum GetSurfaceInternalFormat() const;
270 246
271 protected: 247 protected:
272 // Do not delete directly; use Destroy() or own it with a scoped_ptr, which 248 // Do not delete directly; use Destroy() or own it with a scoped_ptr, which
273 // will Destroy() it properly by default. 249 // will Destroy() it properly by default.
274 virtual ~VideoDecodeAccelerator(); 250 virtual ~VideoDecodeAccelerator();
275 }; 251 };
276 252
277 } // namespace media 253 } // namespace media
278 254
279 namespace std { 255 namespace std {
280 256
281 // Specialize std::default_delete so that scoped_ptr<VideoDecodeAccelerator> 257 // Specialize std::default_delete so that scoped_ptr<VideoDecodeAccelerator>
282 // uses "Destroy()" instead of trying to use the destructor. 258 // uses "Destroy()" instead of trying to use the destructor.
283 template <> 259 template <>
284 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> { 260 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> {
285 void operator()(media::VideoDecodeAccelerator* vda) const; 261 void operator()(media::VideoDecodeAccelerator* vda) const;
286 }; 262 };
287 263
288 } // namespace std 264 } // namespace std
289 265
290 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 266 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « media/video/mock_video_decode_accelerator.h ('k') | media/video/video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698