Bug 1245463: [MSE] P6. Fix incorrect assertions. r=me

mAppendRunning is set prior the append task being queued; so it is possible that the segment parser loop hasn't yet been started, yet mAppendRunning is true.

Separate this diagnostic with a new flag ON A CLOSED TREE.

MozReview-Commit-ID: GgTyyltKOJr
This commit is contained in:
Jean-Yves Avenard 2016-02-12 14:55:10 +11:00
parent 184fb6b1d4
commit 656801b3a7
2 changed files with 11 additions and 2 deletions

View File

@ -104,6 +104,7 @@ TrackBuffersManager::TrackBuffersManager(dom::SourceBufferAttributes* aAttribute
, mEvictionOccurred(false)
, mMonitor("TrackBuffersManager")
, mAppendRunning(false)
, mSegmentParserLoopRunning(false)
{
MOZ_ASSERT(NS_IsMainThread(), "Must be instanciated on the main thread");
}
@ -186,6 +187,7 @@ RefPtr<TrackBuffersManager::RangeRemovalPromise>
TrackBuffersManager::RangeRemoval(TimeUnit aStart, TimeUnit aEnd)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_RELEASE_ASSERT(!mAppendRunning, "Append is running");
MSE_DEBUG("From %.2f to %.2f", aStart.ToSeconds(), aEnd.ToSeconds());
mEnded = false;
@ -299,7 +301,7 @@ void
TrackBuffersManager::CompleteResetParserState()
{
MOZ_ASSERT(OnTaskQueue());
MOZ_RELEASE_ASSERT(!mAppendRunning);
MOZ_RELEASE_ASSERT(!mSegmentParserLoopRunning);
MSE_DEBUG("");
for (auto& track : GetTracksList()) {
@ -435,7 +437,7 @@ bool
TrackBuffersManager::CodedFrameRemoval(TimeInterval aInterval)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(!mAppendRunning, "Logic error: Append in progress");
MOZ_ASSERT(!mSegmentParserLoopRunning, "Logic error: Append in progress");
MSE_DEBUG("From %.2fs to %.2f",
aInterval.mStart.ToSeconds(), aInterval.mEnd.ToSeconds());
@ -574,6 +576,8 @@ TrackBuffersManager::SegmentParserLoop()
{
MOZ_ASSERT(OnTaskQueue());
mSegmentParserLoopRunning = true;
while (true) {
// 1. If the input buffer is empty, then jump to the need more data step below.
if (!mInputBuffer || mInputBuffer->IsEmpty()) {
@ -698,6 +702,7 @@ TrackBuffersManager::NeedMoreData()
MSE_DEBUG("");
RestoreCachedVariables();
mAppendPromise.ResolveIfExists(mActiveTrack, __func__);
mSegmentParserLoopRunning = false;
// Wake-up any pending Abort()
MonitorAutoLock mon(mMonitor);
mAppendRunning = false;
@ -709,6 +714,7 @@ TrackBuffersManager::RejectAppend(nsresult aRejectValue, const char* aName)
{
MSE_DEBUG("rv=%d", aRejectValue);
mAppendPromise.RejectIfExists(aRejectValue, aName);
mSegmentParserLoopRunning = false;
// Wake-up any pending Abort()
MonitorAutoLock mon(mMonitor);
mAppendRunning = false;

View File

@ -352,6 +352,9 @@ private:
mutable Monitor mMonitor;
// Set to true while SegmentParserLoop is running.
Atomic<bool> mAppendRunning;
// Set to true while SegmentParserLoop is running.
// This is for diagnostic only. Only accessed on the task queue.
bool mSegmentParserLoopRunning;
// Stable audio and video track time ranges.
media::TimeIntervals mVideoBufferedRanges;
media::TimeIntervals mAudioBufferedRanges;