Bug 1245463: [MSE] P3. Diags to ensure the Segment Parser Loop isn't running. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 10 Feb 2016 17:50:28 +1100
changeset 329985 1df59c0e738f183a8336d2184cab817188e1d6e1
parent 329984 a5292d3f802cdffaf8715910c8bfbe82e14c383c
child 329986 811c2f2daacb4829d6897e30d48aca2c7ecfcde9
push id10657
push userbmo:jyavenard@mozilla.com
push dateWed, 10 Feb 2016 07:14:42 +0000
reviewersgerald
bugs1245463, 1239983
milestone47.0a1
Bug 1245463: [MSE] P3. Diags to ensure the Segment Parser Loop isn't running. r?gerald This is similar to bug 1239983, we strongly assert should a segment parser loop be running when it must have completed. MozReview-Commit-ID: CXqGoq9Opq0
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -152,17 +152,17 @@ TrackBuffersManager::BufferAppend()
   return InvokeAsync(GetTaskQueue(), this,
                      __func__, &TrackBuffersManager::InitSegmentParserLoop);
 }
 
 void
 TrackBuffersManager::ResetParserState()
 {
   MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(!mAppendRunning, "AbortAppendData must have been called");
+  MOZ_RELEASE_ASSERT(!mAppendRunning, "Append is running, abort must have been called");
   MSE_DEBUG("");
 
   // 1. If the append state equals PARSING_MEDIA_SEGMENT and the input buffer contains some complete coded frames, then run the coded frame processing algorithm until all of these complete coded frames have been processed.
   if (mAppendState == AppendState::PARSING_MEDIA_SEGMENT) {
     nsCOMPtr<nsIRunnable> task =
       NS_NewRunnableMethod(this, &TrackBuffersManager::FinishCodedFrameProcessing);
     GetTaskQueue()->Dispatch(task.forget());
   } else {
@@ -329,17 +329,17 @@ TrackBuffersManager::FinishCodedFramePro
 
   CompleteResetParserState();
 }
 
 void
 TrackBuffersManager::CompleteResetParserState()
 {
   MOZ_ASSERT(OnTaskQueue());
-  MOZ_ASSERT(!mAppendRunning);
+  MOZ_RELEASE_ASSERT(!mAppendRunning);
   MSE_DEBUG("");
 
   for (auto& track : GetTracksList()) {
     // 2. Unset the last decode timestamp on all track buffers.
     // 3. Unset the last frame duration on all track buffers.
     // 4. Unset the highest end timestamp on all track buffers.
     // 5. Set the need random access point flag on all track buffers to true.
     track->ResetAppendState();
@@ -569,17 +569,17 @@ TrackBuffersManager::UpdateBufferedRange
   mOfficialGroupEndTimestamp = mGroupEndTimestamp;
 }
 
 RefPtr<TrackBuffersManager::AppendPromise>
 TrackBuffersManager::InitSegmentParserLoop()
 {
   MOZ_ASSERT(OnTaskQueue());
 
-  MOZ_ASSERT(mAppendPromise.IsEmpty() && !mAppendRunning);
+  MOZ_RELEASE_ASSERT(mAppendPromise.IsEmpty() && !mAppendRunning);
   RefPtr<AppendPromise> p = mAppendPromise.Ensure(__func__);
 
   AppendIncomingBuffers();
   SegmentParserLoop();
 
   return p;
 }
 
@@ -603,16 +603,19 @@ TrackBuffersManager::AppendIncomingBuffe
     TimeInterval(TimeUnit::FromSeconds(mSourceBufferAttributes->GetAppendWindowStart()),
                  TimeUnit::FromSeconds(mSourceBufferAttributes->GetAppendWindowEnd()));
 }
 
 void
 TrackBuffersManager::SegmentParserLoop()
 {
   MOZ_ASSERT(OnTaskQueue());
+
+  mAppendRunning = true;
+
   while (true) {
     // 1. If the input buffer is empty, then jump to the need more data step below.
     if (!mInputBuffer || mInputBuffer->IsEmpty()) {
       NeedMoreData();
       return;
     }
     // 2. If the input buffer contains bytes that violate the SourceBuffer
     // byte stream format specification, then run the append error algorithm with