Bug 1239983 - Diags around TrackBuffersMgr promises - r=jya

Added diagnostics around demuxer init/reset promises, to catch early cases
where TrackBuffersManager::mInputDemuxer is destroyed while an init/reset
promise is in flight, which would cause later issues when the 'Then' clause
assumes that mInputDemuxer still exists.

Note: This is *not* an actual fix for crashes linked to this bug, but it should
help identify unexpected situations, or instead eliminate these patched
locations as sources of crashes.
A new bug will be needed to examine the fallout from this patch and produce a
real fix, or continue investigating.
This commit is contained in:
Gerald Squelart 2016-02-02 20:20:03 +11:00
parent a09371b987
commit 84109cd3c3

View File

@ -786,6 +786,9 @@ TrackBuffersManager::ShutdownDemuxers()
mAudioTracks.mDemuxer->BreakCycles();
mAudioTracks.mDemuxer = nullptr;
}
// We shouldn't change mInputDemuxer while a demuxer init/reset request is
// being processed. See bug 1239983.
MOZ_DIAGNOSTIC_ASSERT(!mDemuxerInitRequest.Exists());
mInputDemuxer = nullptr;
mLastParsedEndTime.reset();
}
@ -843,6 +846,9 @@ TrackBuffersManager::OnDemuxerResetDone(nsresult)
RejectAppend(NS_ERROR_ABORT, __func__);
return;
}
// mInputDemuxer shouldn't have been destroyed while a demuxer init/reset
// request was being processed. See bug 1239983.
MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer);
// Recreate track demuxers.
uint32_t numVideos = mInputDemuxer->GetNumberTracks(TrackInfo::kVideoTrack);
@ -918,6 +924,9 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
RejectAppend(NS_ERROR_ABORT, __func__);
return;
}
// mInputDemuxer shouldn't have been destroyed while a demuxer init/reset
// request was being processed. See bug 1239983.
MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer);
MediaInfo info;