Chromium Code Reviews| Index: media/filters/ffmpeg_audio_decoder.cc |
| diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc |
| index acb0d752fca723572acdc67b4fa33da1abd57222..ad56a875e484e373a28f32956b620ceaad14d1d0 100644 |
| --- a/media/filters/ffmpeg_audio_decoder.cc |
| +++ b/media/filters/ffmpeg_audio_decoder.cc |
| @@ -8,6 +8,7 @@ |
| #include "media/base/audio_decoder_config.h" |
| #include "media/base/data_buffer.h" |
| #include "media/base/demuxer.h" |
| +#include "media/base/message_loop_factory.h" |
|
scherkus (not reviewing)
2012/03/09 20:01:16
not needed
tommi (sloooow) - chröme
2012/03/11 18:49:36
Done.
|
| #include "media/base/pipeline.h" |
| #include "media/ffmpeg/ffmpeg_common.h" |
| @@ -45,8 +46,10 @@ static bool IsEndOfStream(int result, int decoded_size, Buffer* input) { |
| } |
| -FFmpegAudioDecoder::FFmpegAudioDecoder(MessageLoop* message_loop) |
| - : message_loop_(message_loop), |
| +FFmpegAudioDecoder::FFmpegAudioDecoder( |
| + const base::Callback<MessageLoop*()>& message_loop_cb) |
| + : message_loop_cb_(message_loop_cb), |
| + message_loop_(NULL), |
| codec_context_(NULL), |
| bits_per_channel_(0), |
| channel_layout_(CHANNEL_LAYOUT_NONE), |
| @@ -71,8 +74,8 @@ void FFmpegAudioDecoder::Initialize( |
| const scoped_refptr<DemuxerStream>& stream, |
| const PipelineStatusCB& callback, |
| const StatisticsCallback& stats_callback) { |
| - message_loop_->PostTask( |
| - FROM_HERE, |
| + message_loop_ = message_loop_cb_.Run(); |
| + message_loop_->PostTask(FROM_HERE, |
|
scherkus (not reviewing)
2012/03/09 20:01:16
style -- I'd do the following:
message_loop_->Pos
tommi (sloooow) - chröme
2012/03/11 18:49:36
Done.
|
| base::Bind(&FFmpegAudioDecoder::DoInitialize, this, |
| stream, callback, stats_callback)); |
| } |
| @@ -80,8 +83,8 @@ void FFmpegAudioDecoder::Initialize( |
| void FFmpegAudioDecoder::Read(const ReadCB& callback) { |
| // Complete operation asynchronously on different stack of execution as per |
| // the API contract of AudioDecoder::Read() |
| - message_loop_->PostTask(FROM_HERE, base::Bind( |
| - &FFmpegAudioDecoder::DoRead, this, callback)); |
| + message_loop_->PostTask(FROM_HERE, |
|
scherkus (not reviewing)
2012/03/09 20:01:16
ditto here + below (i.e., revert these edits)
tommi (sloooow) - chröme
2012/03/11 18:49:36
Done.
|
| + base::Bind(&FFmpegAudioDecoder::DoRead, this, callback)); |
| } |
| int FFmpegAudioDecoder::bits_per_channel() { |
| @@ -97,8 +100,8 @@ int FFmpegAudioDecoder::samples_per_second() { |
| } |
| void FFmpegAudioDecoder::Reset(const base::Closure& closure) { |
| - message_loop_->PostTask(FROM_HERE, base::Bind( |
| - &FFmpegAudioDecoder::DoReset, this, closure)); |
| + message_loop_->PostTask(FROM_HERE, |
| + base::Bind(&FFmpegAudioDecoder::DoReset, this, closure)); |
| } |
| void FFmpegAudioDecoder::DoInitialize( |
| @@ -249,8 +252,8 @@ void FFmpegAudioDecoder::ReadFromDemuxerStream() { |
| void FFmpegAudioDecoder::DecodeBuffer(const scoped_refptr<Buffer>& buffer) { |
| // TODO(scherkus): fix FFmpegDemuxerStream::Read() to not execute our read |
| // callback on the same execution stack so we can get rid of forced task post. |
| - message_loop_->PostTask(FROM_HERE, base::Bind( |
| - &FFmpegAudioDecoder::DoDecodeBuffer, this, buffer)); |
| + message_loop_->PostTask(FROM_HERE, |
| + base::Bind(&FFmpegAudioDecoder::DoDecodeBuffer, this, buffer)); |
| } |
| void FFmpegAudioDecoder::UpdateDurationAndTimestamp( |