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

Unified Diff: media/filters/opus_audio_decoder.h

Issue 11416367: Add Opus decode wrapper to media. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on updates to webkit/media/filter_helpers.cc Created 8 years 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 | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/opus_audio_decoder.h
diff --git a/media/filters/ffmpeg_audio_decoder.h b/media/filters/opus_audio_decoder.h
similarity index 72%
copy from media/filters/ffmpeg_audio_decoder.h
copy to media/filters/opus_audio_decoder.h
index ce096ee996479d4ac45db0654199f6f6947a05bd..4db8a53abbc05f3fccb3c2842d424338f8fd67f5 100644
--- a/media/filters/ffmpeg_audio_decoder.h
+++ b/media/filters/opus_audio_decoder.h
@@ -2,17 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
-#define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
-
-#include <list>
+#ifndef MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
+#define MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
#include "base/callback.h"
#include "media/base/audio_decoder.h"
#include "media/base/demuxer_stream.h"
-struct AVCodecContext;
-struct AVFrame;
+struct OpusMSDecoder;
namespace base {
class MessageLoopProxy;
@@ -25,9 +22,9 @@ class DataBuffer;
class DecoderBuffer;
struct QueuedAudioBuffer;
-class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder {
+class MEDIA_EXPORT OpusAudioDecoder : public AudioDecoder {
public:
- explicit FFmpegAudioDecoder(
+ explicit OpusAudioDecoder(
const scoped_refptr<base::MessageLoopProxy>& message_loop);
// AudioDecoder implementation.
@@ -41,7 +38,7 @@ class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder {
virtual void Reset(const base::Closure& closure) OVERRIDE;
protected:
- virtual ~FFmpegAudioDecoder();
+ virtual ~OpusAudioDecoder();
private:
// Methods running on decoder thread.
@@ -57,16 +54,17 @@ class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder {
void ReadFromDemuxerStream();
bool ConfigureDecoder();
- void ReleaseFFmpegResources();
+ void CloseDecoder();
void ResetTimestampState();
- void RunDecodeLoop(const scoped_refptr<DecoderBuffer>& input,
- bool skip_eos_append);
+ bool Decode(const scoped_refptr<DecoderBuffer>& input,
+ bool skip_eos_append,
+ scoped_refptr<DataBuffer>* output_buffer);
scoped_refptr<base::MessageLoopProxy> message_loop_;
scoped_refptr<DemuxerStream> demuxer_stream_;
StatisticsCB statistics_cb_;
- AVCodecContext* codec_context_;
+ OpusMSDecoder* opus_decoder_;
// Decoded audio format.
int bits_per_channel_;
@@ -75,25 +73,22 @@ class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder {
// Used for computing output timestamps.
scoped_ptr<AudioTimestampHelper> output_timestamp_helper_;
- int bytes_per_frame_;
base::TimeDelta last_input_timestamp_;
// Number of output sample bytes to drop before generating
// output buffers.
int output_bytes_to_drop_;
- // Holds decoded audio.
- AVFrame* av_frame_;
-
ReadCB read_cb_;
- // Since multiple frames may be decoded from the same packet we need to queue
- // them up and hand them out as we receive Read() calls.
- std::list<QueuedAudioBuffer> queued_audio_;
+ int skip_samples_;
+
+ // Buffer for output from libopus.
+ scoped_array<int16> output_buffer_;
- DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder);
};
} // namespace media
-#endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
+#endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698