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

Unified Diff: media/base/audio_decoder.h

Issue 141243003: Add AudioBufferStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decoderstream_rebased
Patch Set: even more cleanup! Created 6 years, 10 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/filters/decrypting_audio_decoder_unittest.cc » ('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 5aefb84aa67e486971f5836cbdccb3e338abdb08..12ce075aeb26b885c3ef2a47ca19ccc680d7ba51 100644
--- a/media/base/audio_decoder.h
+++ b/media/base/audio_decoder.h
@@ -7,9 +7,11 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
+#include "media/base/audio_decoder_config.h"
#include "media/base/channel_layout.h"
-#include "media/base/pipeline_status.h"
+#include "media/base/decoder_buffer.h"
#include "media/base/media_export.h"
+#include "media/base/pipeline_status.h"
namespace media {
@@ -18,11 +20,13 @@ class DemuxerStream;
class MEDIA_EXPORT AudioDecoder {
public:
- // Status codes for read operations.
+ // Status codes for decode operations.
enum Status {
- kOk,
- kAborted,
- kDecodeError,
+ 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.
};
AudioDecoder();
@@ -31,9 +35,8 @@ class MEDIA_EXPORT AudioDecoder {
// Initializes an AudioDecoder with the given DemuxerStream, executing the
// callback upon completion.
// statistics_cb is used to update global pipeline statistics.
- virtual void Initialize(DemuxerStream* stream,
- const PipelineStatusCB& status_cb,
- const StatisticsCB& statistics_cb) = 0;
+ virtual void Initialize(const AudioDecoderConfig& config,
+ const PipelineStatusCB& status_cb) = 0;
// Requests samples to be decoded and returned via the provided callback.
// Only one read may be in flight at any given time.
@@ -46,8 +49,9 @@ class MEDIA_EXPORT AudioDecoder {
// Read(). This can happen if the DemuxerStream gets flushed and doesn't have
// any more data to return.
typedef base::Callback<void(Status, const scoped_refptr<AudioBuffer>&)>
- ReadCB;
- virtual void Read(const ReadCB& read_cb) = 0;
+ DecodeCB;
+ virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
+ const DecodeCB& decode_cb) = 0;
// Resets decoder state, dropping any queued encoded data.
virtual void Reset(const base::Closure& closure) = 0;
@@ -59,11 +63,22 @@ class MEDIA_EXPORT AudioDecoder {
// complete before deleting the decoder.
virtual void Stop(const base::Closure& closure) = 0;
+ // Returns true if the decoder currently has the ability to decode and return
+ // an AudioBuffer. Most implementations can allocate a new AudioBuffer and
+ // hence this will always return true. Override and return false for decoders
+ // that use a fixed set of AudioBuffers for decoding.
+ virtual bool CanReadWithoutStalling() const;
rileya (GONE FROM CHROMIUM) 2014/02/19 22:37:51 Borrowed this from VideoDecoder, this will be alwa
+
// Returns various information about the decoded audio format.
virtual int bits_per_channel() = 0;
virtual ChannelLayout channel_layout() = 0;
virtual int samples_per_second() = 0;
+ // Some AudioDecoders will get multiple AudioBuffers out of a single
+ // DecoderBuffer, if this returns true, then the client should call Decode()
+ // with null DecoderBuffers until this returns false.
+ virtual bool HasQueuedData() const;
rileya (GONE FROM CHROMIUM) 2014/02/19 22:37:51 This seems like a clunky way of doing this... Anot
+
private:
DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
};
« no previous file with comments | « no previous file | media/base/audio_decoder.cc » ('j') | media/filters/decrypting_audio_decoder_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698