Index: media/filters/ffmpeg_demuxer.cc |
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc |
index 15b6a51fb17b2c77149aa883d4d802f85bca940a..b1d36d0ab4c5c78e879ee154a73af815ca5877a8 100644 |
--- a/media/filters/ffmpeg_demuxer.cc |
+++ b/media/filters/ffmpeg_demuxer.cc |
@@ -557,8 +557,12 @@ FFmpegDemuxer::~FFmpegDemuxer() {} |
void FFmpegDemuxer::Stop(const base::Closure& callback) { |
DCHECK(task_runner_->BelongsToCurrentThread()); |
- url_protocol_->Abort(); |
+ |
+ // The order of Stop() and Abort() is important here. If Abort() is called |
+ // first, control may pass into FFmpeg where it can destruct buffers that are |
+ // in the process of being fulfilled by the DataSource. |
data_source_->Stop(); |
+ url_protocol_->Abort(); |
// This will block until all tasks complete. Note that after this returns it's |
// possible for reply tasks (e.g., OnReadFrameDone()) to be queued on this |