| 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_
|
|
|