Chromium Code Reviews| 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 73% |
| copy from media/filters/ffmpeg_audio_decoder.h |
| copy to media/filters/opus_audio_decoder.h |
| index ce096ee996479d4ac45db0654199f6f6947a05bd..de89275a5784254631de363c60500509e664ebba 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> |
|
scherkus (not reviewing)
2012/12/14 23:39:28
are you using <list>?
Tom Finegan
2012/12/14 23:58:39
Done.
|
| @@ -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,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 +75,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_ |