Bug 1402681 - Part 1: Do not queue the task without task queue. r=jya, a=sledru
authorAlastor Wu <alwu@mozilla.com>
Tue, 26 Sep 2017 17:48:19 +0800
changeset 432018 23eb5e8f91148dab8b9752e3d663a3b5aedaa7cb
parent 432017 afebd547493aa4a6799603fca0f23ca2e9056f60
child 432019 b108bdcaff9d3ec05cd3eba32800b3393409126c
push id7870
push userryanvm@gmail.com
push dateMon, 02 Oct 2017 13:47:52 +0000
treeherdermozilla-beta@b7b894f5fad8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, sledru
bugs1402681
milestone57.0
Bug 1402681 - Part 1: Do not queue the task without task queue. r=jya, a=sledru Since the source buffer is a wrapped native, it would be unlinked twice and then the TrackBuffersManager::Detach() would also be called twice. The first detach task would clear the task queue of TrackBuffersManager, and then we won't accept any new task without task queue. The second detach task should not be executed. MozReview-Commit-ID: AWTzVbRH5B1
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -140,16 +140,25 @@ TrackBuffersManager::DoAppendData(alread
   QueueTask(task);
 
   return p;
 }
 
 void
 TrackBuffersManager::QueueTask(SourceBufferTask* aTask)
 {
+  // The source buffer is a wrapped native, it would be unlinked twice and so
+  // the TrackBuffersManager::Detach() would also be called twice. Since the
+  // detach task has been done before, we could ignore this task.
+  if (!GetTaskQueue()) {
+    MOZ_ASSERT(aTask->GetType() == SourceBufferTask::Type::Detach,
+               "only detach task could happen here!");
+    return;
+  }
+
   if (!OnTaskQueue()) {
     GetTaskQueue()->Dispatch(NewRunnableMethod<RefPtr<SourceBufferTask>>(
       "TrackBuffersManager::QueueTask",
       this,
       &TrackBuffersManager::QueueTask,
       aTask));
     return;
   }