Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Unified Diff: media/filters/decrypting_audio_decoder.cc

Issue 11420070: Remove locking from FFmpegDemuxerStream and associated TODOs from media code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698