Bug 941873. Blocked AudioNodeStreams should not run processing. r=karl a=lsblakk
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 06 Feb 2014 13:35:03 +1300
changeset 176221 b532c1989306a3fa41a0c84cb1945a69429dc8a4
parent 176220 de63d702095ea4d865c0a61fc08d4c88e6fa65da
child 176222 ba817a29eb28c1a95ea93041e41a9ad9bf561b09
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarl, lsblakk
bugs941873
milestone28.0
Bug 941873. Blocked AudioNodeStreams should not run processing. r=karl a=lsblakk
content/media/AudioNodeStream.cpp
--- a/content/media/AudioNodeStream.cpp
+++ b/content/media/AudioNodeStream.cpp
@@ -411,17 +411,18 @@ AudioNodeStream::ProduceOutput(GraphTime
     FinishOutput();
   }
 
   EnsureTrack(AUDIO_TRACK, mSampleRate);
 
   uint16_t outputCount = std::max(uint16_t(1), mEngine->OutputCount());
   mLastChunks.SetLength(outputCount);
 
-  if (mMuted) {
+  bool blocked = mBlocked.GetAt(aFrom);
+  if (mMuted || blocked) {
     for (uint16_t i = 0; i < outputCount; ++i) {
       mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
     }
   } else {
     for (uint16_t i = 0; i < outputCount; ++i) {
       mLastChunks[i].SetNull(0);
     }
 
@@ -436,25 +437,27 @@ AudioNodeStream::ProduceOutput(GraphTime
     if (maxInputs <= 1 && mEngine->OutputCount() <= 1) {
       mEngine->ProduceAudioBlock(this, inputChunks[0], &mLastChunks[0], &finished);
     } else {
       mEngine->ProduceAudioBlocksOnPorts(this, inputChunks, mLastChunks, &finished);
     }
     if (finished) {
       mMarkAsFinishedAfterThisBlock = true;
     }
-  }
 
-  if (mDisabledTrackIDs.Contains(static_cast<TrackID>(AUDIO_TRACK))) {
-    for (uint32_t i = 0; i < mLastChunks.Length(); ++i) {
-      mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
+    if (mDisabledTrackIDs.Contains(static_cast<TrackID>(AUDIO_TRACK))) {
+      for (uint32_t i = 0; i < outputCount; ++i) {
+        mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
+      }
     }
   }
 
-  AdvanceOutputSegment();
+  if (!blocked) {
+    AdvanceOutputSegment();
+  }
 }
 
 void
 AudioNodeStream::AdvanceOutputSegment()
 {
   StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK, mSampleRate);
   AudioSegment* segment = track->Get<AudioSegment>();