Index: chromecast/media/cma/decoder/cast_audio_decoder_linux.cc |
diff --git a/chromecast/media/cma/decoder/cast_audio_decoder_linux.cc b/chromecast/media/cma/decoder/cast_audio_decoder_linux.cc |
index 8fc50ad6bd3f4fa60a888b1673cbcbe5705aeb4b..5e93bb5a3e676950a5d3cbd3a4ab4a9cda7b18e0 100644 |
--- a/chromecast/media/cma/decoder/cast_audio_decoder_linux.cc |
+++ b/chromecast/media/cma/decoder/cast_audio_decoder_linux.cc |
@@ -85,7 +85,10 @@ class CastAudioDecoderImpl : public CastAudioDecoder { |
if (data->decrypt_context() != nullptr) { |
LOG(ERROR) << "Audio decoder doesn't support encrypted stream"; |
- decode_callback.Run(kDecodeError, data); |
+ // Post the task to ensure that |decode_callback| is not called from |
+ // within a call to Decode(). |
+ task_runner_->PostTask(FROM_HERE, |
+ base::Bind(decode_callback, kDecodeError, data)); |
} else if (!initialized_ || decode_pending_) { |
decode_queue_.push(std::make_pair(data, decode_callback)); |
} else { |