Bug 873553 - Part 4: Pass the sampling rate to the engine in SetTimelineParameter; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 24 May 2013 13:10:08 -0400
changeset 144415 59f25c1db41453d11620888b9499ebce5eb0512a
parent 144414 34b39b3d4773ee12206b8c2cb34cd9da339897f2
child 144416 7efdd15be9c7cf8c2d0adf8643b5556cc1a1f5d2
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs873553
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 873553 - Part 4: Pass the sampling rate to the engine in SetTimelineParameter; r=roc
content/media/AudioNodeEngine.h
content/media/AudioNodeStream.cpp
content/media/webaudio/AudioBufferSourceNode.cpp
content/media/webaudio/BiquadFilterNode.cpp
content/media/webaudio/DelayNode.cpp
content/media/webaudio/DynamicsCompressorNode.cpp
content/media/webaudio/GainNode.cpp
--- a/content/media/AudioNodeEngine.h
+++ b/content/media/AudioNodeEngine.h
@@ -171,17 +171,18 @@ public:
   {
     NS_ERROR("Invalid SetDoubleParameter index");
   }
   virtual void SetInt32Parameter(uint32_t aIndex, int32_t aParam)
   {
     NS_ERROR("Invalid SetInt32Parameter index");
   }
   virtual void SetTimelineParameter(uint32_t aIndex,
-                                    const dom::AudioParamTimeline& aValue)
+                                    const dom::AudioParamTimeline& aValue,
+                                    TrackRate aSampleRate)
   {
     NS_ERROR("Invalid SetTimelineParameter index");
   }
   virtual void SetThreeDPointParameter(uint32_t aIndex,
                                        const dom::ThreeDPoint& aValue)
   {
     NS_ERROR("Invalid SetThreeDPointParameter index");
   }
--- a/content/media/AudioNodeStream.cpp
+++ b/content/media/AudioNodeStream.cpp
@@ -104,23 +104,27 @@ AudioNodeStream::SetInt32Parameter(uint3
 void
 AudioNodeStream::SetTimelineParameter(uint32_t aIndex,
                                       const AudioParamTimeline& aValue)
 {
   class Message : public ControlMessage {
   public:
     Message(AudioNodeStream* aStream, uint32_t aIndex,
             const AudioParamTimeline& aValue)
-      : ControlMessage(aStream), mValue(aValue), mIndex(aIndex) {}
+      : ControlMessage(aStream),
+        mValue(aValue),
+        mSampleRate(aStream->SampleRate()),
+        mIndex(aIndex) {}
     virtual void Run()
     {
       static_cast<AudioNodeStream*>(mStream)->Engine()->
-          SetTimelineParameter(mIndex, mValue);
+          SetTimelineParameter(mIndex, mValue, mSampleRate);
     }
     AudioParamTimeline mValue;
+    TrackRate mSampleRate;
     uint32_t mIndex;
   };
   GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
 }
 
 void
 AudioNodeStream::SetThreeDPointParameter(uint32_t aIndex, const ThreeDPoint& aValue)
 {
--- a/content/media/webaudio/AudioBufferSourceNode.cpp
+++ b/content/media/webaudio/AudioBufferSourceNode.cpp
@@ -61,17 +61,19 @@ public:
 
   ~AudioBufferSourceNodeEngine()
   {
     if (mResampler) {
       speex_resampler_destroy(mResampler);
     }
   }
 
-  virtual void SetTimelineParameter(uint32_t aIndex, const dom::AudioParamTimeline& aValue)
+  virtual void SetTimelineParameter(uint32_t aIndex,
+                                    const dom::AudioParamTimeline& aValue,
+                                    TrackRate aSampleRate) MOZ_OVERRIDE
   {
     switch (aIndex) {
     case AudioBufferSourceNode::PLAYBACKRATE:
       mPlaybackRateTimeline = aValue;
       // If we have a simple value that is 1.0 (i.e. intrinsic speed), and our
       // input buffer is already at the ideal audio rate, and we have a
       // resampler, we can release it.
       if (mResampler && mPlaybackRateTimeline.HasSimpleValue() &&
--- a/content/media/webaudio/BiquadFilterNode.cpp
+++ b/content/media/webaudio/BiquadFilterNode.cpp
@@ -97,17 +97,19 @@ public:
   void SetInt32Parameter(uint32_t aIndex, int32_t aValue) MOZ_OVERRIDE
   {
     switch (aIndex) {
     case TYPE: mType = static_cast<BiquadFilterType>(aValue); break;
     default:
       NS_ERROR("Bad BiquadFilterNode Int32Parameter");
     }
   }
-  void SetTimelineParameter(uint32_t aIndex, const AudioParamTimeline& aValue) MOZ_OVERRIDE
+  void SetTimelineParameter(uint32_t aIndex,
+                            const AudioParamTimeline& aValue,
+                            TrackRate aSampleRate) MOZ_OVERRIDE
   {
     MOZ_ASSERT(mSource && mDestination);
     switch (aIndex) {
     case FREQUENCY:
       mFrequency = aValue;
       WebAudioUtils::ConvertAudioParamToTicks(mFrequency, mSource, mDestination);
       break;
     case DETUNE:
--- a/content/media/webaudio/DelayNode.cpp
+++ b/content/media/webaudio/DelayNode.cpp
@@ -79,17 +79,19 @@ public:
   {
     mSource = aSource;
   }
 
   enum Parameters {
     DELAY,
     MAX_DELAY
   };
-  void SetTimelineParameter(uint32_t aIndex, const AudioParamTimeline& aValue) MOZ_OVERRIDE
+  void SetTimelineParameter(uint32_t aIndex,
+                            const AudioParamTimeline& aValue,
+                            TrackRate aSampleRate) MOZ_OVERRIDE
   {
     switch (aIndex) {
     case DELAY:
       MOZ_ASSERT(mSource && mDestination);
       mDelay = aValue;
       WebAudioUtils::ConvertAudioParamToTicks(mDelay, mSource, mDestination);
       break;
     default:
--- a/content/media/webaudio/DynamicsCompressorNode.cpp
+++ b/content/media/webaudio/DynamicsCompressorNode.cpp
@@ -57,17 +57,19 @@ public:
 
   enum Parameters {
     THRESHOLD,
     KNEE,
     RATIO,
     ATTACK,
     RELEASE
   };
-  void SetTimelineParameter(uint32_t aIndex, const AudioParamTimeline& aValue) MOZ_OVERRIDE
+  void SetTimelineParameter(uint32_t aIndex,
+                            const AudioParamTimeline& aValue,
+                            TrackRate aSampleRate) MOZ_OVERRIDE
   {
     MOZ_ASSERT(mSource && mDestination);
     switch (aIndex) {
     case THRESHOLD:
       mThreshold = aValue;
       WebAudioUtils::ConvertAudioParamToTicks(mThreshold, mSource, mDestination);
       break;
     case KNEE:
--- a/content/media/webaudio/GainNode.cpp
+++ b/content/media/webaudio/GainNode.cpp
@@ -29,17 +29,19 @@ public:
     : AudioNodeEngine(aNode)
     , GainProcessor(aDestination)
   {
   }
 
   enum Parameters {
     GAIN
   };
-  void SetTimelineParameter(uint32_t aIndex, const AudioParamTimeline& aValue) MOZ_OVERRIDE
+  void SetTimelineParameter(uint32_t aIndex,
+                            const AudioParamTimeline& aValue,
+                            TrackRate aSampleRate) MOZ_OVERRIDE
   {
     switch (aIndex) {
     case GAIN:
       SetGainParameter(aValue);
       break;
     default:
       NS_ERROR("Bad GainNodeEngine TimelineParameter");
     }