| 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 79%
|
| copy from media/filters/ffmpeg_audio_decoder.h
|
| copy to media/filters/opus_audio_decoder.h
|
| index ce096ee996479d4ac45db0654199f6f6947a05bd..2d77648168dea9e879a2302e2672bd609f96906f 100644
|
| --- a/media/filters/ffmpeg_audio_decoder.h
|
| +++ b/media/filters/opus_audio_decoder.h
|
| @@ -2,8 +2,8 @@
|
| // 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_
|
| +#ifndef MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
|
| +#define MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
|
|
|
| #include <list>
|
|
|
| @@ -11,8 +11,7 @@
|
| #include "media/base/audio_decoder.h"
|
| #include "media/base/demuxer_stream.h"
|
|
|
| -struct AVCodecContext;
|
| -struct AVFrame;
|
| +struct OpusMSDecoder;
|
|
|
| namespace base {
|
| class MessageLoopProxy;
|
| @@ -25,9 +24,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 +40,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 +56,15 @@ 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<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,27 @@ 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_;
|
|
|
| - DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
|
| + int skip_samples_;
|
| + int delay_;
|
| +
|
| + // Buffer for output from libopus.
|
| + scoped_array<uint8> output_buffer_;
|
| +
|
| + DISALLOW_IMPLICIT_CONSTRUCTORS(OpusAudioDecoder);
|
| };
|
|
|
| } // namespace media
|
|
|
| -#endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
|
| +#endif // MEDIA_FILTERS_OPUS_AUDIO_DECODER_H_
|
|
|