Bug 1256510: When shutting down MediaStreamGraphs, if the graph hasn't started, let it start and shut down r?padenot draft
authorRandell Jesup <rjesup@jesup.org>
Tue, 15 Mar 2016 00:35:50 -0400
changeset 340299 07044980d09389fa1d01202d33a68f5c451b5c61
parent 339587 5b6bcc1fec089df9ab8a72dca6abc9d74b81e12c
child 516164 cc660dbad97f6cc6126d6ba53085084f28316790
push id12937
push userrjesup@wgate.com
push dateTue, 15 Mar 2016 04:36:29 +0000
reviewerspadenot
bugs1256510
milestone48.0a1
Bug 1256510: When shutting down MediaStreamGraphs, if the graph hasn't started, let it start and shut down r?padenot MozReview-Commit-ID: 64WjTbaduvu
dom/media/MediaStreamGraph.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1474,16 +1474,24 @@ void
 MediaStreamGraphImpl::ForceShutDown(ShutdownTicket* aShutdownTicket)
 {
   NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread");
   STREAM_LOG(LogLevel::Debug, ("MediaStreamGraph %p ForceShutdown", this));
   {
     MonitorAutoLock lock(mMonitor);
     mForceShutDown = true;
     mForceShutdownTicket = aShutdownTicket;
+    if (mLifecycleState == LIFECYCLE_THREAD_NOT_STARTED) {
+      // We *could* have just sent this a message to start up, so don't
+      // yank the rug out from under it.  Tell it to startup and let it
+      // shut down.
+      RefPtr<GraphDriver> driver = CurrentDriver();
+      MonitorAutoUnlock unlock(mMonitor);
+      driver->Start();
+    }
     EnsureNextIterationLocked();
   }
 }
 
 /* static */ StaticRefPtr<nsIAsyncShutdownBlocker> gMediaStreamGraphShutdownBlocker;
 
 namespace {