From acc023483b493c8980499b77d488147fcca2c743 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Thu, 13 Apr 2017 15:42:52 +0800 Subject: [PATCH] Bug 1351053. P2 - fix data race in accessing mAudioDemuxer/mVideoDemuxer. r=jya 1. http://searchfox.org/mozilla-central/rev/944f87c575e8a0bcefc1ed8efff10b34cf7a5169/dom/media/MediaFormatReader.cpp#755 mAudioDemuxer is modified on the task queue thread of MFR in Shutdown() called by MFR::Shutdown(). 2. http://searchfox.org/mozilla-central/rev/944f87c575e8a0bcefc1ed8efff10b34cf7a5169/dom/media/MediaFormatReader.cpp#1082 mAudioDemuxer is read on the task queue thread of DemuxerProxy in DemuxerProxy::NotifyDataArrived(). MozReview-Commit-ID: 8qLAzNKjuzb --HG-- extra : rebase_source : f39acc8b91dfc8a5480ddca724254de128cff22b extra : source : 76544a99e0651667e5331c5d93c2cd335f61dd46 --- dom/media/MediaFormatReader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 4a14c62c8827..477871f44953 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -751,8 +751,6 @@ public: RefPtr Shutdown() { - mData->mAudioDemuxer = nullptr; - mData->mVideoDemuxer = nullptr; RefPtr data = mData.forget(); return InvokeAsync(mTaskQueue, __func__, [data]() { // We need to clear our reference to the demuxer now. So that in the event @@ -760,6 +758,8 @@ public: // mediasource demuxer that is waiting on more data, it will force the // init promise to be rejected. data->mDemuxer = nullptr; + data->mAudioDemuxer = nullptr; + data->mVideoDemuxer = nullptr; return ShutdownPromise::CreateAndResolve(true, __func__); }); }