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
This commit is contained in:
JW Wang 2017-04-13 15:42:52 +08:00
Родитель bd27d7c7ff
Коммит acc023483b
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -751,8 +751,6 @@ public:
RefPtr<ShutdownPromise> Shutdown() RefPtr<ShutdownPromise> Shutdown()
{ {
mData->mAudioDemuxer = nullptr;
mData->mVideoDemuxer = nullptr;
RefPtr<Data> data = mData.forget(); RefPtr<Data> data = mData.forget();
return InvokeAsync(mTaskQueue, __func__, [data]() { return InvokeAsync(mTaskQueue, __func__, [data]() {
// We need to clear our reference to the demuxer now. So that in the event // 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 // mediasource demuxer that is waiting on more data, it will force the
// init promise to be rejected. // init promise to be rejected.
data->mDemuxer = nullptr; data->mDemuxer = nullptr;
data->mAudioDemuxer = nullptr;
data->mVideoDemuxer = nullptr;
return ShutdownPromise::CreateAndResolve(true, __func__); return ShutdownPromise::CreateAndResolve(true, __func__);
}); });
} }