Bug 1132342: Handle race should operation be aborted while reading metadata. r=karlt a=lsblakk
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 24 Feb 2015 16:38:41 +1100
changeset 262341 19443ff644bdeaa19d89c381ec4107a9e5fa3532
parent 262340 04c022de147f074f8182031294e459c87d2a404b
child 262342 643bbfda477319a4c6a76d9bf1ddef35674b3b2d
push id1963
push userpaolo.mozmail@amadzone.org
push dateSun, 10 May 2015 10:26:20 +0000
reviewerskarlt, lsblakk
bugs1132342
milestone38.0a2
Bug 1132342: Handle race should operation be aborted while reading metadata. r=karlt a=lsblakk
dom/media/mediasource/TrackBuffer.cpp
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -634,16 +634,20 @@ TrackBuffer::InitializeDecoder(SourceBuf
   }
   // HACK END.
 
   reader->SetIdle();
   if (mShutdown) {
     MSE_DEBUG("was shut down while reading metadata. Aborting initialization.");
     return;
   }
+  if (mCurrentDecoder != aDecoder) {
+    MSE_DEBUG("append was cancelled. Aborting initialization.");
+    return;
+  }
 
   if (NS_SUCCEEDED(rv) && reader->IsWaitingOnCDMResource()) {
     mWaitingDecoders.AppendElement(aDecoder);
     return;
   }
 
   aDecoder->SetTaskQueue(nullptr);