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

Unified Diff: media/filters/gpu_video_decoder.h

Issue 297553002: Add callback in VideoDecoder and AudioDecoder to return decoded frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/gpu_video_decoder.h
diff --git a/media/filters/gpu_video_decoder.h b/media/filters/gpu_video_decoder.h
index 290dec85c332bd75c98b7cc50daff9e748b9eb3e..91145c7886c41377a04ae529ceb28671ff44e3ba 100644
--- a/media/filters/gpu_video_decoder.h
+++ b/media/filters/gpu_video_decoder.h
@@ -44,13 +44,15 @@ class MEDIA_EXPORT GpuVideoDecoder
// VideoDecoder implementation.
virtual void Initialize(const VideoDecoderConfig& config,
bool live_mode,
- const PipelineStatusCB& status_cb) OVERRIDE;
+ const PipelineStatusCB& status_cb,
+ const OutputCB& output_cb) OVERRIDE;
virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
const DecodeCB& decode_cb) OVERRIDE;
virtual void Reset(const base::Closure& closure) OVERRIDE;
virtual void Stop() OVERRIDE;
virtual bool NeedsBitstreamConversion() const OVERRIDE;
virtual bool CanReadWithoutStalling() const OVERRIDE;
+ virtual int GetMaxDecodeRequests() const OVERRIDE;
// VideoDecodeAccelerator::Client implementation.
virtual void ProvidePictureBuffers(uint32 count,
@@ -83,25 +85,19 @@ class MEDIA_EXPORT GpuVideoDecoder
};
// A SHMBuffer and the DecoderBuffer its data came from.
- struct BufferPair {
- BufferPair(SHMBuffer* s, const scoped_refptr<DecoderBuffer>& b);
- ~BufferPair();
+ struct PendingDecoderBuffer {
+ PendingDecoderBuffer(SHMBuffer* s,
+ const scoped_refptr<DecoderBuffer>& b,
+ const DecodeCB& done_cb);
+ ~PendingDecoderBuffer();
SHMBuffer* shm_buffer;
scoped_refptr<DecoderBuffer> buffer;
+ DecodeCB done_cb;
};
typedef std::map<int32, PictureBuffer> PictureBufferMap;
- // Return true if more decode work can be piled on to the VDA.
- bool CanMoreDecodeWorkBeDone();
-
- // Enqueue a frame for later delivery (or drop it on the floor if a
- // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest
- // ready frame to the client if there is a pending read. A NULL |frame|
- // merely triggers delivery, and requires the ready_video_frames_ queue not be
- // empty.
- void EnqueueFrameAndTriggerFrameDelivery(
- const scoped_refptr<VideoFrame>& frame);
+ void DeliverFrame(const scoped_refptr<VideoFrame>& frame);
// Static method is to allow it to run even after GVD is deleted.
static void ReleaseMailbox(
@@ -141,9 +137,11 @@ class MEDIA_EXPORT GpuVideoDecoder
// occurs.
scoped_ptr<VideoDecodeAccelerator> vda_;
- // Callbacks that are !is_null() only during their respective operation being
- // asynchronously executed.
- DecodeCB pending_decode_cb_;
+ OutputCB output_cb_;
+
+ DecodeCB eos_decode_cb_;
+
+ // Not null only during reset.
base::Closure pending_reset_cb_;
State state_;
@@ -157,7 +155,7 @@ class MEDIA_EXPORT GpuVideoDecoder
scoped_refptr<MediaLog> media_log_;
- std::map<int32, BufferPair> bitstream_buffers_in_decoder_;
+ std::map<int32, PendingDecoderBuffer> bitstream_buffers_in_decoder_;
PictureBufferMap assigned_picture_buffers_;
// PictureBuffers given to us by VDA via PictureReady, which we sent forward
// as VideoFrames to be rendered via decode_cb_, and which will be returned
@@ -182,7 +180,6 @@ class MEDIA_EXPORT GpuVideoDecoder
// picture_buffer_id and the frame wrapping the corresponding Picture, for
// frames that have been decoded but haven't been requested by a Decode() yet.
- std::list<scoped_refptr<VideoFrame> > ready_video_frames_;
int32 next_picture_buffer_id_;
int32 next_bitstream_buffer_id_;

Powered by Google App Engine
This is Rietveld 408576698