Bug 1189506. Remove MediaStream::mBlockInThisPhase. r=karlt
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 04 Sep 2015 16:57:32 +1200
changeset 297201 23f79deaebee8ac1248ca418a23a557803d1c129
parent 297200 9a3e38b1d42641553f95e484d07fa28b445d1f75
child 297202 45bbd595ac1830991fd87812a3753b13762caa3d
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1189506
milestone43.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 1189506. Remove MediaStream::mBlockInThisPhase. r=karlt
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraph.h
dom/media/MediaStreamGraphImpl.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -730,76 +730,68 @@ MediaStreamGraphImpl::RecomputeBlocking(
   // The next state computed time can be the same as the previous: it
   // means the driver would be have been blocking indefinitly, but the graph has
   // been woken up right after having been to sleep.
   MOZ_ASSERT(aEndBlockingDecisions >= mStateComputedTime);
   mStateComputedTime = aEndBlockingDecisions;
 }
 
 void
-MediaStreamGraphImpl::MarkStreamBlocking(MediaStream* aStream)
-{
-  if (aStream->mBlockInThisPhase)
-    return;
-  aStream->mBlockInThisPhase = true;
-}
-
-void
 MediaStreamGraphImpl::RecomputeBlockingAt(MediaStream* aStream,
                                           GraphTime aTime,
                                           GraphTime aEndBlockingDecisions,
                                           GraphTime* aEnd)
 {
-  aStream->mBlockInThisPhase = false;
+  bool block = false;
 
   do {
     if (aStream->mFinished) {
       GraphTime endTime = StreamTimeToGraphTime(aStream,
           aStream->GetStreamBuffer().GetAllTracksEnd());
       if (endTime <= aTime) {
         STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is blocked due to being finished", aStream));
         // We'll block indefinitely
-        MarkStreamBlocking(aStream);
+        block = true;
         *aEnd = std::min(*aEnd, aEndBlockingDecisions);
         continue;
       } else {
         STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is finished, but not blocked yet (end at %f, with blocking at %f)",
             aStream, MediaTimeToSeconds(aStream->GetBufferEnd()),
             MediaTimeToSeconds(endTime)));
         *aEnd = std::min(*aEnd, endTime);
       }
     }
 
     GraphTime end;
     bool explicitBlock = aStream->mExplicitBlockerCount.GetAt(aTime, &end) > 0;
     *aEnd = std::min(*aEnd, end);
     if (explicitBlock) {
       STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is blocked due to explicit blocker", aStream));
-      MarkStreamBlocking(aStream);
+      block = true;
       continue;
     }
 
     if (aStream->IsSuspended()) {
       STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is blocked due to being suspended", aStream));
-      MarkStreamBlocking(aStream);
+      block = true;
       continue;
     }
 
     bool underrun = WillUnderrun(aStream, aTime, aEndBlockingDecisions, aEnd);
     if (underrun) {
       // We'll block indefinitely
-      MarkStreamBlocking(aStream);
+      block = true;
       *aEnd = std::min(*aEnd, aEndBlockingDecisions);
       continue;
     }
   } while (false);
 
   NS_ASSERTION(*aEnd > aTime, "Failed to advance!");
 
-  aStream->mBlocked.SetAtAndAfter(aTime, aStream->mBlockInThisPhase);
+  aStream->mBlocked.SetAtAndAfter(aTime, block);
 }
 
 void
 MediaStreamGraphImpl::NotifyHasCurrentData(MediaStream* aStream)
 {
   if (!aStream->mNotifiedHasCurrentData && aStream->mHasCurrentData) {
     for (uint32_t j = 0; j < aStream->mListeners.Length(); ++j) {
       MediaStreamListener* l = aStream->mListeners[j];
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -712,18 +712,16 @@ protected:
   /**
    * True if mHasCurrentData is true and we've notified listeners.
    */
   bool mNotifiedHasCurrentData;
 
   // True if the stream is being consumed (i.e. has track data being played,
   // or is feeding into some stream that is being consumed).
   bool mIsConsumed;
-  // True if this stream should be blocked in this phase.
-  bool mBlockInThisPhase;
 
   // This state is only used on the main thread.
   DOMMediaStream* mWrapper;
   // Main-thread views of state
   StreamTime mMainThreadCurrentTime;
   bool mMainThreadFinished;
   bool mFinishedNotificationSent;
   bool mMainThreadDestroyed;
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -300,22 +300,16 @@ public:
    * Compute the blocking states of streams from mStateComputedTime
    * until the desired future time aEndBlockingDecisions.
    * Updates mStateComputedTime and sets MediaStream::mBlocked
    * for all streams.
    */
   void RecomputeBlocking(GraphTime aEndBlockingDecisions);
 
   /**
-   * Mark a stream blocked at time aTime. If this results in decisions that need
-   * to be revisited at some point in the future, *aEnd will be reduced to the
-   * first time in the future to recompute those decisions.
-   */
-  void MarkStreamBlocking(MediaStream* aStream);
-  /**
    * Recompute blocking for the streams in aStreams for the interval starting at aTime.
    * If this results in decisions that need to be revisited at some point
    * in the future, *aEnd will be reduced to the first time in the future to
    * recompute those decisions.
    */
   void RecomputeBlockingAt(MediaStream* aStream,
                            GraphTime aTime, GraphTime aEndBlockingDecisions,
                            GraphTime* aEnd);