b=923301 remove now-unnecessary AcceptPlayingRefRelease r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 25 Oct 2013 12:11:24 +1300
changeset 166792 1a12845a97ce8c4b2a00d61228ea7485afe648ff
parent 166791 9ced7065dec43d658cbab16ebbd8209583d5badc
child 166793 42bb49c927055e9def5195b311db6341ff978755
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs923301
milestone27.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
b=923301 remove now-unnecessary AcceptPlayingRefRelease r=roc
content/media/webaudio/AudioNode.cpp
content/media/webaudio/AudioNode.h
content/media/webaudio/ConvolverNode.cpp
content/media/webaudio/ConvolverNode.h
content/media/webaudio/DelayNode.cpp
content/media/webaudio/DelayNode.h
content/media/webaudio/PlayingRefChangeHandler.h
--- a/content/media/webaudio/AudioNode.cpp
+++ b/content/media/webaudio/AudioNode.cpp
@@ -171,17 +171,16 @@ AudioNode::Connect(AudioNode& aDestinati
     ProcessedMediaStream* ps =
       static_cast<ProcessedMediaStream*>(aDestination.mStream.get());
     MOZ_ASSERT(aInput <= UINT16_MAX, "Unexpected large input port number");
     MOZ_ASSERT(aOutput <= UINT16_MAX, "Unexpected large output port number");
     input->mStreamPort =
       ps->AllocateInputPort(mStream, MediaInputPort::FLAG_BLOCK_INPUT,
                             static_cast<uint16_t>(aInput),
                             static_cast<uint16_t>(aOutput));
-    aDestination.NotifyInputConnected();
   }
 
   // This connection may have connected a panner and a source.
   Context()->UpdatePannerSource();
 }
 
 void
 AudioNode::Connect(AudioParam& aDestination, uint32_t aOutput,
--- a/content/media/webaudio/AudioNode.h
+++ b/content/media/webaudio/AudioNode.h
@@ -194,18 +194,16 @@ public:
   }
   const nsTArray<nsRefPtr<AudioParam> >& OutputParams() const
   {
     return mOutputParams;
   }
 
   void RemoveOutputParam(AudioParam* aParam);
 
-  virtual void NotifyInputConnected() {}
-
   // MarkActive() asks the context to keep the AudioNode alive until the
   // context is finished.  This takes care of "playing" references and
   // "tail-time" references.
   void MarkActive() { Context()->RegisterActiveNode(this); }
   // Active nodes call MarkInactive() when they have finished producing sound
   // for the foreseeable future.
   // Do not call MarkInactive from a node destructor.  If the destructor is
   // called, then the node is already inactive.
--- a/content/media/webaudio/ConvolverNode.cpp
+++ b/content/media/webaudio/ConvolverNode.cpp
@@ -121,19 +121,17 @@ public:
     AudioChunk input = aInput;
     if (aInput.IsNull()) {
       AllocateAudioBlock(1, &input);
       WriteZeroesToAudioBlock(&input, 0, WEBAUDIO_BLOCK_SIZE);
 
       mLeftOverData -= WEBAUDIO_BLOCK_SIZE;
       if (mLeftOverData <= 0) {
         // Note: this keeps spamming the main thread with messages as long
-        // as there is nothing to play. This isn't great, but it avoids
-        // problems with some messages being ignored when they're rejected by
-        // ConvolverNode::AcceptPlayingRefRelease.
+        // as there is nothing to play. This isn't great.
         mLeftOverData = 0;
         nsRefPtr<PlayingRefChanged> refchanged =
           new PlayingRefChanged(aStream, PlayingRefChanged::RELEASE);
         NS_DispatchToMainThread(refchanged);
       }
     } else {
       if (aInput.mVolume != 1.0f) {
         // Pre-multiply the input's volume
@@ -170,17 +168,16 @@ private:
   bool mSeenInput;
 };
 
 ConvolverNode::ConvolverNode(AudioContext* aContext)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Clamped_max,
               ChannelInterpretation::Speakers)
-  , mMediaStreamGraphUpdateIndexAtLastInputConnection(0)
   , mNormalize(true)
 {
   ConvolverNodeEngine* engine = new ConvolverNodeEngine(this, mNormalize);
   mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
 }
 
 JSObject*
 ConvolverNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
--- a/content/media/webaudio/ConvolverNode.h
+++ b/content/media/webaudio/ConvolverNode.h
@@ -51,31 +51,18 @@ public:
   virtual void SetChannelCountModeValue(ChannelCountMode aMode, ErrorResult& aRv) MOZ_OVERRIDE
   {
     if (aMode == ChannelCountMode::Max) {
       aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
       return;
     }
     AudioNode::SetChannelCountModeValue(aMode, aRv);
   }
-  virtual void NotifyInputConnected() MOZ_OVERRIDE
-  {
-    mMediaStreamGraphUpdateIndexAtLastInputConnection =
-      mStream->Graph()->GetCurrentGraphUpdateIndex();
-  }
-  bool AcceptPlayingRefRelease(int64_t aLastGraphUpdateIndexProcessed) const
-  {
-    // Reject any requests to release the playing ref if the request was issued
-    // before the MediaStreamGraph was aware of the most-recently-added input
-    // connection.
-    return aLastGraphUpdateIndexProcessed >= mMediaStreamGraphUpdateIndexAtLastInputConnection;
-  }
 
 private:
-  int64_t mMediaStreamGraphUpdateIndexAtLastInputConnection;
   nsRefPtr<AudioBuffer> mBuffer;
   bool mNormalize;
 };
 
 
 } //end namespace dom
 } //end namespace mozilla
 
--- a/content/media/webaudio/DelayNode.cpp
+++ b/content/media/webaudio/DelayNode.cpp
@@ -90,18 +90,17 @@ public:
         nsRefPtr<PlayingRefChanged> refchanged =
           new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF);
         NS_DispatchToMainThread(refchanged);
       }
       mLeftOverData = mProcessor.MaxDelayFrames();
     } else if (mLeftOverData != INT32_MIN) {
       if (mLeftOverData <= 0) {
         // Continue spamming the main thread with messages until we are destroyed.
-        // This isn't great, but it ensures a message will get through even if
-        // some are ignored by DelayNode::AcceptPlayingRefRelease
+        // This isn't great.
         mLeftOverData = 0;
         playedBackAllLeftOvers = true;
 
         nsRefPtr<PlayingRefChanged> refchanged =
           new PlayingRefChanged(aStream, PlayingRefChanged::RELEASE);
         NS_DispatchToMainThread(refchanged);
       }
       mLeftOverData -= WEBAUDIO_BLOCK_SIZE;
@@ -168,17 +167,16 @@ public:
   int32_t mLeftOverData;
 };
 
 DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
   : AudioNode(aContext,
               2,
               ChannelCountMode::Max,
               ChannelInterpretation::Speakers)
-  , mMediaStreamGraphUpdateIndexAtLastInputConnection(0)
   , mDelay(new AudioParam(MOZ_THIS_IN_INITIALIZER_LIST(),
                           SendDelayToStream, 0.0f))
 {
   DelayNodeEngine* engine =
     new DelayNodeEngine(this, aContext->Destination(),
                         ceil(aContext->SampleRate() * aMaxDelay));
   mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
   engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
--- a/content/media/webaudio/DelayNode.h
+++ b/content/media/webaudio/DelayNode.h
@@ -32,35 +32,21 @@ public:
     return mDelay;
   }
 
   virtual const DelayNode* AsDelayNode() const MOZ_OVERRIDE
   {
     return this;
   }
 
-  virtual void NotifyInputConnected() MOZ_OVERRIDE
-  {
-    mMediaStreamGraphUpdateIndexAtLastInputConnection =
-      mStream->Graph()->GetCurrentGraphUpdateIndex();
-  }
-  bool AcceptPlayingRefRelease(int64_t aLastGraphUpdateIndexProcessed) const
-  {
-    // Reject any requests to release the playing ref if the request was issued
-    // before the MediaStreamGraph was aware of the most-recently-added input
-    // connection.
-    return aLastGraphUpdateIndexProcessed >= mMediaStreamGraphUpdateIndexAtLastInputConnection;
-  }
-
 private:
   static void SendDelayToStream(AudioNode* aNode);
   friend class DelayNodeEngine;
 
 private:
-  int64_t mMediaStreamGraphUpdateIndexAtLastInputConnection;
   nsRefPtr<AudioParam> mDelay;
 };
 
 }
 }
 
 #endif
 
--- a/content/media/webaudio/PlayingRefChangeHandler.h
+++ b/content/media/webaudio/PlayingRefChangeHandler.h
@@ -14,18 +14,17 @@ namespace mozilla {
 namespace dom {
 
 template<class NodeType>
 class PlayingRefChangeHandler : public nsRunnable
 {
 public:
   enum ChangeType { ADDREF, RELEASE };
   PlayingRefChangeHandler(AudioNodeStream* aStream, ChangeType aChange)
-    : mLastProcessedGraphUpdateIndex(aStream->GetProcessingGraphUpdateIndex())
-    , mStream(aStream)
+    : mStream(aStream)
     , mChange(aChange)
   {
   }
 
   NS_IMETHOD Run()
   {
     nsRefPtr<NodeType> node;
     {
@@ -34,26 +33,24 @@ public:
       // we can obtain the reference, we will hold the node alive in
       // this function.
       MutexAutoLock lock(mStream->Engine()->NodeMutex());
       node = static_cast<NodeType*>(mStream->Engine()->Node());
     }
     if (node) {
       if (mChange == ADDREF) {
         node->MarkActive();
-      } else if (mChange == RELEASE &&
-                 node->AcceptPlayingRefRelease(mLastProcessedGraphUpdateIndex)) {
+      } else if (mChange == RELEASE) {
         node->MarkInactive();
       }
     }
     return NS_OK;
   }
 
 private:
-  int64_t mLastProcessedGraphUpdateIndex;
   nsRefPtr<AudioNodeStream> mStream;
   ChangeType mChange;
 };
 
 }
 }
 
 #endif