b=1080958 end current SourceBufferResource before Shutdown of TrackBuffer::mTaskQueue r=kinetik
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 10 Oct 2014 17:13:10 +1300
changeset 210052 2d0a1d87170024ca2ef2d2a5400f9b8ffe143373
parent 210051 c033be95eb1f218b60182b9613c905b3f46a6450
child 210053 86da49382e3ba111380edf4183a2b6203456ed2f
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskinetik
bugs1080958
milestone35.0a1
b=1080958 end current SourceBufferResource before Shutdown of TrackBuffer::mTaskQueue r=kinetik
content/media/mediasource/TrackBuffer.cpp
--- a/content/media/mediasource/TrackBuffer.cpp
+++ b/content/media/mediasource/TrackBuffer.cpp
@@ -70,24 +70,28 @@ public:
 
 private:
   nsTArray<nsRefPtr<SourceBufferDecoder>> mDecoders;
 };
 
 void
 TrackBuffer::Shutdown()
 {
+  // End the SourceBufferResource associated with mCurrentDecoder, which will
+  // unblock any decoder initialization in ReadMetadata().
+  DiscardDecoder();
+
+  // Finish any decoder initialization, which may add to mInitializedDecoders.
   // Shutdown waits for any pending events, which may require the monitor,
   // so we must not hold the monitor during this call.
   mParentDecoder->GetReentrantMonitor().AssertNotCurrentThreadIn();
   mTaskQueue->Shutdown();
   mTaskQueue = nullptr;
 
   ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
-  DiscardDecoder();
   for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
     mDecoders[i]->GetReader()->Shutdown();
   }
   mInitializedDecoders.Clear();
   NS_DispatchToMainThread(new ReleaseDecoderTask(mDecoders));
   MOZ_ASSERT(mDecoders.IsEmpty());
   mParentDecoder = nullptr;
 }