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 a74d7dd2cbb3a053304bf11ba33de7c45ec92779..b0b6c2f7652aef103edd62c75b1eb81df8b79a98 100644 |
| --- a/media/filters/ffmpeg_audio_decoder.cc |
| +++ b/media/filters/ffmpeg_audio_decoder.cc |
| @@ -189,7 +189,12 @@ void FFmpegAudioDecoder::DoRead(const ReadCB& read_cb) { |
| void FFmpegAudioDecoder::DoDecodeBuffer( |
| DemuxerStream::Status status, |
| const scoped_refptr<DecoderBuffer>& input) { |
| - DCHECK(message_loop_->BelongsToCurrentThread()); |
| + if (!message_loop_->BelongsToCurrentThread()) { |
| + message_loop_->PostTask(FROM_HERE, base::Bind( |
| + &FFmpegAudioDecoder::DoDecodeBuffer, this, status, input)); |
| + return; |
| + } |
| + |
| DCHECK(!read_cb_.is_null()); |
| DCHECK(queued_audio_.empty()); |
| @@ -365,18 +370,7 @@ void FFmpegAudioDecoder::DoDecodeBuffer( |
| void FFmpegAudioDecoder::ReadFromDemuxerStream() { |
| DCHECK(!read_cb_.is_null()); |
| - demuxer_stream_->Read(base::Bind(&FFmpegAudioDecoder::DecodeBuffer, this)); |
| -} |
| - |
| -void FFmpegAudioDecoder::DecodeBuffer( |
| - DemuxerStream::Status status, |
| - const scoped_refptr<DecoderBuffer>& buffer) { |
| - DCHECK_EQ(status != DemuxerStream::kOk, !buffer) << status; |
|
xhwang
2012/11/20 17:54:34
Do you want to keep this check?
scherkus (not reviewing)
2012/11/20 19:16:07
Done.
|
| - |
| - // 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, status, buffer)); |
| + demuxer_stream_->Read(base::Bind(&FFmpegAudioDecoder::DoDecodeBuffer, this)); |
| } |
| base::TimeDelta FFmpegAudioDecoder::GetNextOutputTimestamp() const { |
| @@ -385,4 +379,5 @@ base::TimeDelta FFmpegAudioDecoder::GetNextOutputTimestamp() const { |
| base::Time::kMicrosecondsPerSecond; |
| return output_timestamp_base_ + base::TimeDelta::FromMicroseconds(decoded_us); |
| } |
| + |
| } // namespace media |