Index: media/filters/ffmpeg_demuxer.cc |
=================================================================== |
--- media/filters/ffmpeg_demuxer.cc (revision 41387) |
+++ media/filters/ffmpeg_demuxer.cc (working copy) |
@@ -235,6 +235,7 @@ |
// in the decoder filters. By reaching this point, all filters should have |
// stopped, so this is the only safe place to do the global clean up. |
// TODO(hclam): close the codecs in the corresponding decoders. |
+ AutoLock auto_lock(FFmpegLock::get()->lock()); |
if (!format_context_) |
return; |
@@ -396,12 +397,17 @@ |
DCHECK(context); |
format_context_ = context; |
- // Fully initialize AVFormatContext by parsing the stream a little. |
- result = av_find_stream_info(format_context_); |
- if (result < 0) { |
- host()->SetError(DEMUXER_ERROR_COULD_NOT_PARSE); |
- callback->Run(); |
- return; |
+ // Serialize calls to av_find_stream_info(). |
+ { |
+ AutoLock auto_lock(FFmpegLock::get()->lock()); |
+ |
+ // Fully initialize AVFormatContext by parsing the stream a little. |
+ result = av_find_stream_info(format_context_); |
+ if (result < 0) { |
+ host()->SetError(DEMUXER_ERROR_COULD_NOT_PARSE); |
+ callback->Run(); |
+ return; |
+ } |
} |
// Create demuxer streams for all supported streams. |