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

Unified Diff: media/base/audio_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
« no previous file with comments | « no previous file | media/base/audio_decoder.cc » ('j') | media/base/video_decoder.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_decoder.h
diff --git a/media/base/audio_decoder.h b/media/base/audio_decoder.h
index 5c5e2941175dc8911cda4ae89db80c5aa7b982e0..261006bf9f230c7c9f0a706c99d2625e0c61c0da 100644
--- a/media/base/audio_decoder.h
+++ b/media/base/audio_decoder.h
@@ -26,45 +26,52 @@ class MEDIA_EXPORT AudioDecoder {
enum Status {
kOk, // We're all good.
kAborted, // We aborted as a result of Stop() or Reset().
- kNotEnoughData, // Not enough data to produce a video frame.
kDecodeError, // A decoding error occurred.
kDecryptError // Decrypting error happened.
};
+ // Callback to return decoded buffers.
+ typedef base::Callback<void(const scoped_refptr<AudioBuffer>&)> OutputCB;
+
+ // Callback for Decode(). Called after the decoder has completed decoding
+ // corresponding DecoderBuffer, indicating that it's ready to accept another
+ // buffer to decode.
+ typedef base::Callback<void(Status)> DecodeCB;
+
AudioDecoder();
virtual ~AudioDecoder();
// Initializes an AudioDecoder with the given DemuxerStream, executing the
// callback upon completion.
- // statistics_cb is used to update global pipeline statistics.
+ // |statistics_cb| is used to update global pipeline statistics.
+ // |output_cb| is called for decoded audio buffers (see Decode()).
virtual void Initialize(const AudioDecoderConfig& config,
- const PipelineStatusCB& status_cb) = 0;
+ const PipelineStatusCB& status_cb,
+ const OutputCB& output_cb) = 0;
- // Requests samples to be decoded and returned via the provided callback.
- // Only one decode may be in flight at any given time.
+ // Requests samples to be decoded. Only one decode may be in flight at any
+ // given time. Once the buffer is decoded the decoder calls |decode_cb|.
+ // |output_cb| specified in Initialize() is called for each decoded buffer,
+ // before or after |decode_cb|.
//
- // Implementations guarantee that the callback will not be called from within
+ // Implementations guarantee that the callbacks will not be called from within
// this method.
//
// Non-NULL sample buffer pointers will contain decoded audio data or may
// indicate the end of the stream. A NULL buffer pointer indicates an aborted
// Decode().
xhwang 2014/06/05 21:53:48 This should be consistent with the comment for Vid
Sergey Ulanov 2014/06/06 22:49:39 Done.
- typedef base::Callback<void(Status, const scoped_refptr<AudioBuffer>&)>
- DecodeCB;
virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
const DecodeCB& decode_cb) = 0;
- // Some AudioDecoders will queue up multiple AudioBuffers from a single
- // DecoderBuffer, if we have any such queued buffers this will return the next
- // one. Otherwise we return a NULL AudioBuffer.
- virtual scoped_refptr<AudioBuffer> GetDecodeOutput();
-
- // Resets decoder state, dropping any queued encoded data.
+ // Resets decoder state, dropping any queued data. DecodeCB and OutputCB may
+ // still be called for older buffers if they were scheduler before this method
xhwang 2014/06/05 21:53:48 s/scheduler/scheduled
Sergey Ulanov 2014/06/06 22:49:39 Done.
+ // is called.
virtual void Reset(const base::Closure& closure) = 0;
// Stops decoder, fires any pending callbacks and sets the decoder to an
// uninitialized state. An AudioDecoder cannot be re-initialized after it has
- // been stopped.
+ // been stopped. DecodeCB and OutputCB may still be called for older buffers
+ // if they were scheduler before this method is called.
xhwang 2014/06/05 21:53:48 s/scheduler/scheduled
Sergey Ulanov 2014/06/06 22:49:39 Done.
// Note that if Initialize() is pending or has finished successfully, Stop()
// must be called before destructing the decoder.
virtual void Stop() = 0;
« no previous file with comments | « no previous file | media/base/audio_decoder.cc » ('j') | media/base/video_decoder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698