bug 1190285 remove unused DispatchWhenNotEnoughBuffered r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 31 Jul 2015 18:46:04 +1200
changeset 287725 2bcb21c74b7438c6587466ab60b92692633b87f8
parent 287724 e89ea131df69dcace07e483eac07fc569c1c0bfe
child 287726 9db3e1d16ff58fd900d94f8d3a9482d255b0c251
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1190285
milestone42.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 1190285 remove unused DispatchWhenNotEnoughBuffered r=padenot
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraph.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -260,52 +260,38 @@ MediaStreamGraphImpl::ExtractPendingInpu
     FinishStream(aStream);
   }
 }
 
 void
 MediaStreamGraphImpl::UpdateBufferSufficiencyState(SourceMediaStream* aStream)
 {
   StreamTime desiredEnd = GetDesiredBufferEnd(aStream);
-  nsTArray<SourceMediaStream::ThreadAndRunnable> runnables;
-
   {
     MutexAutoLock lock(aStream->mMutex);
     for (uint32_t i = 0; i < aStream->mUpdateTracks.Length(); ++i) {
       SourceMediaStream::TrackData* data = &aStream->mUpdateTracks[i];
       if (data->mCommands & SourceMediaStream::TRACK_CREATE) {
         // This track hasn't been created yet, so we have no sufficiency
         // data. The track will be created in the next iteration of the
         // control loop and then we'll fire insufficiency notifications
         // if necessary.
         continue;
       }
       if (data->mCommands & SourceMediaStream::TRACK_END) {
-        // This track will end, so no point in firing not-enough-data
-        // callbacks.
+        // This track will end, so no point updating.
         continue;
       }
       StreamBuffer::Track* track = aStream->mBuffer.FindTrack(data->mID);
       // Note that track->IsEnded() must be false, otherwise we would have
       // removed the track from mUpdateTracks already.
       NS_ASSERTION(!track->IsEnded(), "What is this track doing here?");
       data->mHaveEnough = track->GetEnd() >= desiredEnd;
-      if (!data->mHaveEnough) {
-        runnables.MoveElementsFrom(data->mDispatchWhenNotEnough);
-      }
     }
   }
-
-  for (uint32_t i = 0; i < runnables.Length(); ++i) {
-    // This dispatch was observed to fail in test_video_dimensions.html on
-    // win8 64 debug when invoked from noop_resampler::fill on the cubeb audio
-    // thread.
-    nsCOMPtr<nsIRunnable> r = runnables[i].mRunnable;
-    runnables[i].mTarget->Dispatch(r.forget(), AbstractThread::DontAssertDispatchSuccess);
-  }
 }
 
 StreamTime
 MediaStreamGraphImpl::GraphTimeToStreamTime(MediaStream* aStream,
                                             GraphTime aTime)
 {
   MOZ_ASSERT(aTime <= CurrentDriver()->StateComputedTime(),
                "Don't ask about times where we haven't made blocking decisions yet");
@@ -2665,38 +2651,16 @@ SourceMediaStream::GetEndOfAppendedData(
   if (track) {
     return track->mEndOfFlushedData + track->mData->GetDuration();
   }
   NS_ERROR("Track not found");
   return 0;
 }
 
 void
-SourceMediaStream::DispatchWhenNotEnoughBuffered(TrackID aID,
-    TaskQueue* aSignalQueue, nsIRunnable* aSignalRunnable)
-{
-  MutexAutoLock lock(mMutex);
-  TrackData* data = FindDataForTrack(aID);
-  if (!data) {
-    nsCOMPtr<nsIRunnable> r = aSignalRunnable;
-    aSignalQueue->Dispatch(r.forget());
-    return;
-  }
-
-  if (data->mHaveEnough) {
-    if (data->mDispatchWhenNotEnough.IsEmpty()) {
-      data->mDispatchWhenNotEnough.AppendElement()->Init(aSignalQueue, aSignalRunnable);
-    }
-  } else {
-    nsCOMPtr<nsIRunnable> r = aSignalRunnable;
-    aSignalQueue->Dispatch(r.forget());
-  }
-}
-
-void
 SourceMediaStream::EndTrack(TrackID aID)
 {
   MutexAutoLock lock(mMutex);
   TrackData *track = FindDataForTrack(aID);
   if (track) {
     track->mCommands |= TRACK_END;
   }
   if (auto graph = GraphImpl()) {
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -823,24 +823,16 @@ public:
   /**
    * Get the stream time of the end of the data that has been appended so far.
    * Can be called from any thread but won't be useful if it can race with
    * an AppendToTrack call, so should probably just be called from the thread
    * that also calls AppendToTrack.
    */
   StreamTime GetEndOfAppendedData(TrackID aID);
   /**
-   * Ensures that aSignalRunnable will be dispatched to aSignalThread
-   * when we don't have enough buffered data in the track (which could be
-   * immediately). Will dispatch the runnable immediately if the track
-   * does not exist. No op if a runnable is already present for this track.
-   */
-  void DispatchWhenNotEnoughBuffered(TrackID aID,
-      TaskQueue* aSignalQueue, nsIRunnable* aSignalRunnable);
-  /**
    * Indicate that a track has ended. Do not do any more API calls
    * affecting this track.
    * Ignored if the track does not exist.
    */
   void EndTrack(TrackID aID);
   /**
    * Indicate that no tracks will be added starting before time aKnownTime.
    * aKnownTime must be >= its value at the last call to AdvanceKnownTracksTime.
@@ -925,17 +917,16 @@ protected:
     int mResamplerChannelCount;
 #endif
     StreamTime mStart;
     // End-time of data already flushed to the track (excluding mData)
     StreamTime mEndOfFlushedData;
     // Each time the track updates are flushed to the media graph thread,
     // the segment buffer is emptied.
     nsAutoPtr<MediaSegment> mData;
-    nsTArray<ThreadAndRunnable> mDispatchWhenNotEnough;
     // Each time the track updates are flushed to the media graph thread,
     // this is cleared.
     uint32_t mCommands;
     bool mHaveEnough;
   };
 
   bool NeedsMixing();