Bug 1572627 update mProcessedTime for each block r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 21 Nov 2019 23:12:37 +0000
changeset 503383 e1838026425e8ac7b2b204f16165d4232a0e26ca
parent 503382 f19f757691cfd3b36a228b0734dee0cb7a1a5372
child 503384 75a9f4f8b4908f53e2b315f1475acfa15f48575e
push id36833
push userbtara@mozilla.com
push dateFri, 22 Nov 2019 21:40:53 +0000
treeherdermozilla-central@2c912e46295e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1572627
milestone72.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 1572627 update mProcessedTime for each block r=padenot Differential Revision: https://phabricator.services.mozilla.com/D54083
dom/media/MediaTrackGraph.cpp
--- a/dom/media/MediaTrackGraph.cpp
+++ b/dom/media/MediaTrackGraph.cpp
@@ -1062,35 +1062,34 @@ GraphTime MediaTrackGraphImpl::RoundUpTo
   return nextTime;
 }
 
 void MediaTrackGraphImpl::ProduceDataForTracksBlockByBlock(
     uint32_t aTrackIndex, TrackRate aSampleRate) {
   MOZ_ASSERT(OnGraphThread());
   MOZ_ASSERT(aTrackIndex <= mFirstCycleBreaker,
              "Cycle breaker is not AudioNodeTrack?");
-  GraphTime t = mProcessedTime;
-  while (t < mStateComputedTime) {
-    GraphTime next = RoundUpToNextAudioBlock(t);
+  while (mProcessedTime < mStateComputedTime) {
+    GraphTime next = RoundUpToNextAudioBlock(mProcessedTime);
     for (uint32_t i = mFirstCycleBreaker; i < mTracks.Length(); ++i) {
       auto nt = static_cast<AudioNodeTrack*>(mTracks[i]);
       MOZ_ASSERT(nt->AsAudioNodeTrack());
-      nt->ProduceOutputBeforeInput(t);
+      nt->ProduceOutputBeforeInput(mProcessedTime);
     }
     for (uint32_t i = aTrackIndex; i < mTracks.Length(); ++i) {
       ProcessedMediaTrack* pt = mTracks[i]->AsProcessedTrack();
       if (pt) {
         pt->ProcessInput(
-            t, next,
+            mProcessedTime, next,
             (next == mStateComputedTime) ? ProcessedMediaTrack::ALLOW_END : 0);
       }
     }
-    t = next;
+    mProcessedTime = next;
   }
-  NS_ASSERTION(t == mStateComputedTime,
+  NS_ASSERTION(mProcessedTime == mStateComputedTime,
                "Something went wrong with rounding to block boundaries");
 }
 
 void MediaTrackGraphImpl::RunMessageAfterProcessing(
     UniquePtr<ControlMessage> aMessage) {
   MOZ_ASSERT(OnGraphThread());
 
   if (mFrontMessageQueue.IsEmpty()) {
@@ -1255,16 +1254,17 @@ void MediaTrackGraphImpl::Process() {
                                                track, mStateComputedTime));
         }
       }
     }
     if (track->mStartBlocking > oldProcessedTime) {
       allBlockedForever = false;
     }
   }
+  mProcessedTime = mStateComputedTime;
 
   // This is the number of frames that are written to the output buffer, for
   // this iteration.
   TrackTime ticksPlayed = 0;
   // Only playback audio and video in real-time mode
   if (mRealtime) {
     if (CurrentDriver()->AsAudioCallbackDriver()) {
       for (auto& t : mAudioOutputs) {
@@ -1349,20 +1349,19 @@ bool MediaTrackGraphImpl::OneIterationIm
   // Process graph message from the main thread for this iteration.
   RunMessagesInQueue();
 
   GraphTime stateEnd = std::min(aStateEnd, GraphTime(mEndTime));
   UpdateGraph(stateEnd);
 
   mStateComputedTime = stateEnd;
 
+  GraphTime oldProcessedTime = mProcessedTime;
   Process();
-
-  GraphTime oldProcessedTime = mProcessedTime;
-  mProcessedTime = stateEnd;
+  MOZ_ASSERT(mProcessedTime == stateEnd);
 
   UpdateCurrentTimeForTracks(oldProcessedTime);
 
   ProcessChunkMetadata(oldProcessedTime);
 
   // Process graph messages queued from RunMessageAfterProcessing() on this
   // thread during the iteration.
   RunMessagesInQueue();