Bug 1503132 do not shut down graph thread on completion of offline rendering r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 30 Oct 2018 14:59:52 +0000
changeset 443667 61d08765489c9e1edda2b4105287caf401deb94a
parent 443666 7e9935a07eaf0bc2f25e6fa7b49446f9c815e0b2
child 443668 d9eda2382bd9f6d9a83799f749ca87266b363542
push id109420
push useraciure@mozilla.com
push dateWed, 31 Oct 2018 05:11:56 +0000
treeherdermozilla-inbound@b357da105c49 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1503132
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1503132 do not shut down graph thread on completion of offline rendering r=padenot AudioWorket will need to keep processing events on the graph thread. The graph thread is instead shut down when the AudioContext is destroyed. Depends on D10165 Differential Revision: https://phabricator.services.mozilla.com/D10166
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraphImpl.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1225,28 +1225,16 @@ MediaStreamGraphImpl::ProduceDataForStre
       }
     }
     t = next;
   }
   NS_ASSERTION(t == mStateComputedTime,
                "Something went wrong with rounding to block boundaries");
 }
 
-bool
-MediaStreamGraphImpl::AllFinishedStreamsNotified()
-{
-  MOZ_ASSERT(OnGraphThread());
-  for (MediaStream* stream : AllStreams()) {
-    if (stream->mFinished && !stream->mNotifiedFinished) {
-      return false;
-    }
-  }
-  return true;
-}
-
 void
 MediaStreamGraphImpl::RunMessageAfterProcessing(UniquePtr<ControlMessage> aMessage)
 {
   MOZ_ASSERT(OnGraphThread());
 
   if (mFrontMessageQueue.IsEmpty()) {
     mFrontMessageQueue.AppendElement();
   }
@@ -1446,17 +1434,16 @@ MediaStreamGraphImpl::Process()
 }
 
 bool
 MediaStreamGraphImpl::UpdateMainThreadState()
 {
   MOZ_ASSERT(OnGraphThread());
   MonitorAutoLock lock(mMonitor);
   bool finalUpdate = mForceShutDown ||
-    (mProcessedTime >= mEndTime && AllFinishedStreamsNotified()) ||
     (IsEmpty() && mBackMessageQueue.IsEmpty());
   PrepareUpdatesToMainThreadState(finalUpdate);
   if (finalUpdate) {
     // Enter shutdown mode when this iteration is completed.
     // No need to Destroy streams here. The main-thread owner of each
     // stream is responsible for calling Destroy on them.
     return false;
   }
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -214,21 +214,16 @@ public:
    */
   void EnsureStableStateEventPosted();
   /**
    * Generate messages to the main thread to update it for all state changes.
    * mMonitor must be held.
    */
   void PrepareUpdatesToMainThreadState(bool aFinalUpdate);
   /**
-   * Returns false if there is any stream that has finished but not yet finished
-   * playing out.
-   */
-  bool AllFinishedStreamsNotified();
-  /**
    * If we are rendering in non-realtime mode, we don't want to send messages to
    * the main thread at each iteration for performance reasons. We instead
    * notify the main thread at the same rate
    */
   bool ShouldUpdateMainThread();
   // The following methods are the various stages of RunThread processing.
   /**
    * Advance all stream state to mStateComputedTime.