Bug 867104 - r=ehsan
authorPaul Adenot <paul@paul.cx>
Tue, 14 May 2013 14:14:42 +0200
changeset 131860 744de2aced8cd2b4176f4274327586040e40ddde
parent 131859 c5f04b74f0922777bc4ef65cd786850067cad751
child 131861 d98e7c680020219847eb2786111fecfdf753af68
push id28006
push userpaul@paul.cx
push dateTue, 14 May 2013 12:14:59 +0000
treeherdermozilla-inbound@d98e7c680020 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs867104
milestone24.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 867104 - r=ehsan
content/media/webaudio/AudioBufferSourceNode.cpp
content/media/webaudio/AudioBufferSourceNode.h
--- a/content/media/webaudio/AudioBufferSourceNode.cpp
+++ b/content/media/webaudio/AudioBufferSourceNode.cpp
@@ -445,17 +445,16 @@ AudioBufferSourceNode::AudioBufferSource
   , mLoopEnd(0.0)
   , mOffset(0.0)
   , mDuration(std::numeric_limits<double>::min())
   , mPlaybackRate(new AudioParam(this, SendPlaybackRateToStream, 1.0f))
   , mGain(new AudioParam(this, SendGainToStream, 1.0f))
   , mLoop(false)
   , mStartCalled(false)
   , mStopped(false)
-  , mOffsetAndDurationRemembered(false)
 {
   AudioBufferSourceNodeEngine* engine =
       new AudioBufferSourceNodeEngine(this, aContext->Destination());
   mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
   engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
   mStream->AddMainThreadListener(this);
 }
 
@@ -489,22 +488,21 @@ AudioBufferSourceNode::Start(double aWhe
   }
 
   if (mBuffer) {
     double duration = aDuration.WasPassed() ?
                       aDuration.Value() :
                       std::numeric_limits<double>::min();
     SendOffsetAndDurationParametersToStream(ns, aOffset, duration);
   } else {
-    // Remember our argument so that we can use them once we have a buffer
+    // Remember our arguments so that we can use them once we have a buffer
     mOffset = aOffset;
     mDuration = aDuration.WasPassed() ?
                 aDuration.Value() :
                 std::numeric_limits<double>::min();
-    mOffsetAndDurationRemembered = true;
   }
 
   // Don't set parameter unnecessarily
   if (aWhen > 0.0) {
     ns->SetStreamTimeParameter(START, Context()->DestinationStream(), aWhen);
   }
 
   MOZ_ASSERT(!mPlayingRef, "We can only accept a successful start() call once");
@@ -522,19 +520,17 @@ AudioBufferSourceNode::SendBufferParamet
     nsRefPtr<ThreadSharedFloatArrayBufferList> data =
       mBuffer->GetThreadSharedChannelsForRate(aCx);
     ns->SetBuffer(data.forget());
     ns->SetInt32Parameter(SAMPLE_RATE, rate);
   } else {
     ns->SetBuffer(nullptr);
   }
 
-  if (mOffsetAndDurationRemembered) {
-    SendOffsetAndDurationParametersToStream(ns, mOffset, mDuration);
-  }
+  SendOffsetAndDurationParametersToStream(ns, mOffset, mDuration);
 }
 
 void
 AudioBufferSourceNode::SendOffsetAndDurationParametersToStream(AudioNodeStream* aStream,
                                                                double aOffset,
                                                                double aDuration)
 {
   float rate = mBuffer ? mBuffer->SampleRate() : Context()->SampleRate();
--- a/content/media/webaudio/AudioBufferSourceNode.h
+++ b/content/media/webaudio/AudioBufferSourceNode.h
@@ -147,16 +147,15 @@ private:
   double mDuration;
   nsRefPtr<AudioBuffer> mBuffer;
   nsRefPtr<AudioParam> mPlaybackRate;
   nsRefPtr<AudioParam> mGain;
   SelfReference<AudioBufferSourceNode> mPlayingRef; // a reference to self while playing
   bool mLoop;
   bool mStartCalled;
   bool mStopped;
-  bool mOffsetAndDurationRemembered;
 };
 
 }
 }
 
 #endif