Chromium Code Reviews| Index: media/filters/decrypting_audio_decoder.cc |
| diff --git a/media/filters/decrypting_audio_decoder.cc b/media/filters/decrypting_audio_decoder.cc |
| index d53498e7e26e4cf9ea62b41e641074f751922470..c7dd5d879cad9a961b656445d0328d04ac9f7fa0 100644 |
| --- a/media/filters/decrypting_audio_decoder.cc |
| +++ b/media/filters/decrypting_audio_decoder.cc |
| @@ -234,26 +234,20 @@ void DecryptingAudioDecoder::ReadFromDemuxerStream() { |
| DCHECK(!read_cb_.is_null()); |
| demuxer_stream_->Read( |
| - base::Bind(&DecryptingAudioDecoder::DecryptAndDecodeBuffer, this)); |
| -} |
| - |
| -void DecryptingAudioDecoder::DecryptAndDecodeBuffer( |
| - DemuxerStream::Status status, |
| - const scoped_refptr<DecoderBuffer>& buffer) { |
| - // In theory, we don't need to force post the task here, because we do a |
|
scherkus (not reviewing)
2012/11/19 19:11:16
xhwang: let me know if you want to keep this (alth
xhwang
2012/11/20 17:54:34
Nop, I don't see a reason to keep it now :) Thanks
|
| - // force task post in DeliverFrame(). Therefore, even if |
| - // demuxer_stream_->Read() execute the read callback on the same execution |
| - // stack we are still fine. But it looks like a force post task makes the |
| - // logic more understandable and manageable, so why not? |
| - message_loop_->PostTask(FROM_HERE, base::Bind( |
| - &DecryptingAudioDecoder::DoDecryptAndDecodeBuffer, this, status, buffer)); |
| + base::Bind(&DecryptingAudioDecoder::DoDecryptAndDecodeBuffer, this)); |
| } |
| void DecryptingAudioDecoder::DoDecryptAndDecodeBuffer( |
| DemuxerStream::Status status, |
| const scoped_refptr<DecoderBuffer>& buffer) { |
| + if (!message_loop_->BelongsToCurrentThread()) { |
| + message_loop_->PostTask(FROM_HERE, base::Bind( |
| + &DecryptingAudioDecoder::DoDecryptAndDecodeBuffer, this, |
| + status, buffer)); |
| + return; |
| + } |
| + |
| DVLOG(3) << "DoDecryptAndDecodeBuffer()"; |
| - DCHECK(message_loop_->BelongsToCurrentThread()); |
| DCHECK_EQ(state_, kPendingDemuxerRead) << state_; |
| DCHECK(!read_cb_.is_null()); |
| DCHECK_EQ(buffer != NULL, status == DemuxerStream::kOk) << status; |