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

Side by Side Diff: media/video/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 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"
13 #include "media/base/bitstream_buffer.h" 15 #include "media/base/bitstream_buffer.h"
14 #include "media/base/surface_manager.h" 16 #include "media/base/surface_manager.h"
15 #include "media/base/video_decoder_config.h" 17 #include "media/base/video_decoder_config.h"
16 #include "media/video/picture.h" 18 #include "media/video/picture.h"
17 #include "ui/gfx/geometry/size.h" 19 #include "ui/gfx/geometry/size.h"
18 20
19 typedef unsigned int GLenum; 21 typedef unsigned int GLenum;
20 22
23 namespace base {
24 class SingleThreadTaskRunner;
25 }
26
21 namespace media { 27 namespace media {
22 28
23 // Video decoder interface. 29 // Video decoder interface.
24 // This interface is extended by the various components that ultimately 30 // This interface is extended by the various components that ultimately
25 // implement the backend of PPB_VideoDecoder_Dev. 31 // implement the backend of PPB_VideoDecoder_Dev.
26 class MEDIA_EXPORT VideoDecodeAccelerator { 32 class MEDIA_EXPORT VideoDecodeAccelerator {
27 public: 33 public:
28 // Specification of a decoding profile supported by an decoder. 34 // Specification of a decoding profile supported by an decoder.
29 // |max_resolution| and |min_resolution| are inclusive. 35 // |max_resolution| and |min_resolution| are inclusive.
30 struct MEDIA_EXPORT SupportedProfile { 36 struct MEDIA_EXPORT SupportedProfile {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // "seek". 222 // "seek".
217 virtual void Reset() = 0; 223 virtual void Reset() = 0;
218 224
219 // Destroys the decoder: all pending inputs are dropped immediately and the 225 // Destroys the decoder: all pending inputs are dropped immediately and the
220 // component is freed. This call may asynchornously free system resources, 226 // component is freed. This call may asynchornously free system resources,
221 // but its client-visible effects are synchronous. After this method returns 227 // but its client-visible effects are synchronous. After this method returns
222 // no more callbacks will be made on the client. Deletes |this| 228 // no more callbacks will be made on the client. Deletes |this|
223 // unconditionally, so make sure to drop all pointers to it! 229 // unconditionally, so make sure to drop all pointers to it!
224 virtual void Destroy() = 0; 230 virtual void Destroy() = 0;
225 231
226 // GPU PROCESS ONLY. Implementations of this interface in the 232 // TO BE CALLED IN THE SAME PROCESS AS THE VDA IMPLEMENTATION ONLY.
227 // content/common/gpu/media should implement this, and implementations in 233 //
228 // other processes should not override the default implementation. 234 // A decode "task" is a sequence that includes a Decode() call from Client,
229 // Returns true if VDA::Decode and VDA::Client callbacks can run on the IO 235 // as well as corresponding callbacks to return the input BitstreamBuffer
230 // thread. Otherwise they will run on the GPU child thread. The purpose of 236 // after use, and the resulting output Picture(s).
231 // running Decode on the IO thread is to reduce decode latency. Note Decode 237 //
232 // should return as soon as possible and not block on the IO thread. Also, 238 // If the Client can support running these three calls on a separate thread,
233 // PictureReady should be run on the child thread if a picture is delivered 239 // it may call this method to try to set up the VDA implementation to do so.
234 // the first time so it can be cleared. 240 // If the VDA can support this as well, return true, otherwise return false.
235 virtual bool CanDecodeOnIOThread(); 241 // If true is returned, the client may submit each Decode() call (but no other
242 // calls) on |decode_task_runner|, and should then expect that
243 // NotifyEndOfBitstreamBuffer() and PictureReady() callbacks may come on
244 // |decode_task_runner| as well, called on |decode_client|, instead of client
245 // provided to Initialize().
246 //
247 // NOTE 1: some callbacks may still have to come on the main thread and the
248 // Client should handle both callbacks coming on main and |decode_task_runner|
249 // thread.
250 //
251 // NOTE 2: VDA implementations of Decode() must return as soon as possible and
252 // never block, as |decode_task_runner| may be a latency critical thread
253 // (such as the GPU IO thread).
254 //
255 // One application of this is offloading the GPU Child thread. In general,
256 // calls to VDA in GPU process have to be done on the GPU Child thread, as
257 // they may require GL context to be current. However, some VDAs may be able
258 // to run decode operations without GL context, which helps reduce latency and
259 // offloads the GPU Child thread.
260 virtual bool TryInitializeDecodeOnSeparateThread(
kcwu 2016/03/02 09:00:12 When to call this method? From the your implementa
Pawel Osciak 2016/03/02 10:16:49 Done.
261 const base::WeakPtr<Client>& decode_client,
262 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner);
236 263
237 // Windows creates a BGRA texture. 264 // Windows creates a BGRA texture.
238 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 265 // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691
239 virtual GLenum GetSurfaceInternalFormat() const; 266 virtual GLenum GetSurfaceInternalFormat() const;
240 267
241 protected: 268 protected:
242 // Do not delete directly; use Destroy() or own it with a scoped_ptr, which 269 // Do not delete directly; use Destroy() or own it with a scoped_ptr, which
243 // will Destroy() it properly by default. 270 // will Destroy() it properly by default.
244 virtual ~VideoDecodeAccelerator(); 271 virtual ~VideoDecodeAccelerator();
245 }; 272 };
246 273
247 } // namespace media 274 } // namespace media
248 275
249 namespace std { 276 namespace std {
250 277
251 // Specialize std::default_delete so that scoped_ptr<VideoDecodeAccelerator> 278 // Specialize std::default_delete so that scoped_ptr<VideoDecodeAccelerator>
252 // uses "Destroy()" instead of trying to use the destructor. 279 // uses "Destroy()" instead of trying to use the destructor.
253 template <> 280 template <>
254 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> { 281 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> {
255 void operator()(media::VideoDecodeAccelerator* vda) const; 282 void operator()(media::VideoDecodeAccelerator* vda) const;
256 }; 283 };
257 284
258 } // namespace std 285 } // namespace std
259 286
260 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 287 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698