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

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

Powered by Google App Engine
This is Rietveld 408576698