summaryrefslogtreecommitdiffstats
path: root/chromium/media/video/video_decode_accelerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/media/video/video_decode_accelerator.h')
-rw-r--r--chromium/media/video/video_decode_accelerator.h59
1 files changed, 44 insertions, 15 deletions
diff --git a/chromium/media/video/video_decode_accelerator.h b/chromium/media/video/video_decode_accelerator.h
index 5212db2c488..4df3b1c9158 100644
--- a/chromium/media/video/video_decode_accelerator.h
+++ b/chromium/media/video/video_decode_accelerator.h
@@ -8,7 +8,6 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/memory/weak_ptr.h"
#include "media/base/bitstream_buffer.h"
#include "media/base/video_decoder_config.h"
#include "media/video/picture.h"
@@ -19,11 +18,8 @@ namespace media {
// Video decoder interface.
// This interface is extended by the various components that ultimately
// implement the backend of PPB_VideoDecode_Dev.
-class MEDIA_EXPORT VideoDecodeAccelerator
- : public base::SupportsWeakPtr<VideoDecodeAccelerator> {
+class MEDIA_EXPORT VideoDecodeAccelerator {
public:
- virtual ~VideoDecodeAccelerator();
-
// Enumeration of potential errors generated by the API.
// Note: Keep these in sync with PP_VideoDecodeError_Dev. Also do not
// rearrange, reuse or remove values as they are used for gathering UMA
@@ -44,15 +40,13 @@ class MEDIA_EXPORT VideoDecodeAccelerator
};
// Interface for collaborating with picture interface to provide memory for
- // output picture and blitting them.
+ // output picture and blitting them. These callbacks will not be made unless
+ // Initialize() has returned successfully.
// This interface is extended by the various layers that relay messages back
// to the plugin, through the PPP_VideoDecode_Dev interface the plugin
// implements.
class MEDIA_EXPORT Client {
public:
- // Callback to notify client that decoder has been initialized.
- virtual void NotifyInitializeDone() = 0;
-
// Callback to tell client how many and what size of buffers to provide.
virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers,
const gfx::Size& dimensions,
@@ -74,7 +68,9 @@ class MEDIA_EXPORT VideoDecodeAccelerator
// Reset completion callback.
virtual void NotifyResetDone() = 0;
- // Callback to notify about decoding errors.
+ // Callback to notify about decoding errors. Note that errors in
+ // Initialize() will not be reported here, but will instead be indicated by
+ // a false return value there.
virtual void NotifyError(Error error) = 0;
protected:
@@ -83,14 +79,16 @@ class MEDIA_EXPORT VideoDecodeAccelerator
// Video decoder functions.
- // Initializes the video decoder with specific configuration.
+ // Initializes the video decoder with specific configuration. Called once per
+ // decoder construction. This call is synchronous and returns true iff
+ // initialization is successful.
// Parameters:
// |profile| is the video stream's format profile.
- //
- // Returns true when command successfully accepted. Otherwise false.
- virtual bool Initialize(VideoCodecProfile profile) = 0;
+ // |client| is the client of this video decoder. The provided pointer must
+ // be valid until Destroy() is called.
+ virtual bool Initialize(VideoCodecProfile profile, Client* client) = 0;
- // Decodes given bitstream buffer that contains at most one frame. Once
+ // Decodes given bitstream buffer that contains at most one frame. Once
// decoder is done with processing |bitstream_buffer| it will call
// NotifyEndOfBitstreamBuffer() with the bitstream buffer id.
// Parameters:
@@ -133,8 +131,39 @@ class MEDIA_EXPORT VideoDecodeAccelerator
// no more callbacks will be made on the client. Deletes |this|
// unconditionally, so make sure to drop all pointers to it!
virtual void Destroy() = 0;
+
+ // GPU PROCESS ONLY. Implementations of this interface in the
+ // content/common/gpu/media should implement this, and implementations in
+ // other processes should not override the default implementation.
+ // Returns true if VDA::Decode and VDA::Client callbacks can run on the IO
+ // thread. Otherwise they will run on the GPU child thread. The purpose of
+ // running Decode on the IO thread is to reduce decode latency. Note Decode
+ // should return as soon as possible and not block on the IO thread. Also,
+ // PictureReady should be run on the child thread if a picture is delivered
+ // the first time so it can be cleared.
+ virtual bool CanDecodeOnIOThread();
+
+ protected:
+ // Do not delete directly; use Destroy() or own it with a scoped_ptr, which
+ // will Destroy() it properly by default.
+ virtual ~VideoDecodeAccelerator();
};
} // namespace media
+namespace base {
+
+template <class T>
+struct DefaultDeleter;
+
+// Specialize DefaultDeleter so that scoped_ptr<VideoDecodeAccelerator> always
+// uses "Destroy()" instead of trying to use the destructor.
+template <>
+struct MEDIA_EXPORT DefaultDeleter<media::VideoDecodeAccelerator> {
+ public:
+ void operator()(void* video_decode_accelerator) const;
+};
+
+} // namespace base
+
#endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_