diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 5c484f5078ea..8eb8f3d2e4c1 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -1558,12 +1558,11 @@ class MediaStreamGraphShutDownRunnable : public Runnable { // mGraph is no longer needed, so delete it. mGraph->Destroy(); } else { - // The graph is not empty. We must be in a forced shutdown, or a - // non-realtime graph that has finished processing. Some later - // AppendMessage will detect that the graph has been emptied, and - // delete it. - NS_ASSERTION(mGraph->mForceShutDown || !mGraph->mRealtime, - "Not in forced shutdown?"); + // The graph is not empty. We must be in a forced shutdown, either for + // process shutdown or a non-realtime graph that has finished + // processing. Some later AppendMessage will detect that the graph has + // been emptied, and delete it. + NS_ASSERTION(mGraph->mForceShutDown, "Not in forced shutdown?"); mGraph->LifecycleStateRef() = MediaStreamGraphImpl::LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION; } @@ -1730,7 +1729,7 @@ void MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG) { } } - if ((mForceShutDown || !mRealtime) && + if (mForceShutDown && LifecycleStateRef() == LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP) { // Defer calls to RunDuringShutdown() to happen while mMonitor is not // held. diff --git a/dom/media/MediaStreamGraphImpl.h b/dom/media/MediaStreamGraphImpl.h index e46d729d7e6b..8d23d48a2ae1 100644 --- a/dom/media/MediaStreamGraphImpl.h +++ b/dom/media/MediaStreamGraphImpl.h @@ -812,7 +812,8 @@ class MediaStreamGraphImpl : public MediaStreamGraph, } /** - * True when we need to do a forced shutdown during application shutdown. + * True when we need to do a forced shutdown, during application shutdown or + * when shutting down a non-realtime graph. * Only set on main thread. * Can be read safely on the main thread, on all other threads mMonitor must * be held.