Bug 864083 - Cleanup AudioBuffer::GetThreadSharedChannelsForRate; r=padenot

This commit is contained in:
Ehsan Akhgari 2013-04-22 08:12:45 -04:00
parent 285c08c9eb
commit d7d8be9b4a
4 changed files with 7 additions and 17 deletions

View File

@ -165,8 +165,7 @@ StealJSArrayDataIntoThreadSharedFloatArrayBufferList(JSContext* aJSContext,
}
ThreadSharedFloatArrayBufferList*
AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext, uint32_t* aRate,
uint32_t* aLength)
AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext)
{
if (!mSharedChannels) {
// Steal JS data
@ -174,8 +173,6 @@ AudioBuffer::GetThreadSharedChannelsForRate(JSContext* aJSContext, uint32_t* aRa
StealJSArrayDataIntoThreadSharedFloatArrayBufferList(aJSContext, mJSChannels);
}
*aLength = mLength;
*aRate = mSampleRate;
return mSharedChannels;
}

View File

@ -89,12 +89,9 @@ public:
}
/**
* Returns a ThreadSharedFloatArrayBufferList containing the sample data
* at aRate. Sets *aLength to the number of samples per channel.
* Returns a ThreadSharedFloatArrayBufferList containing the sample data.
*/
ThreadSharedFloatArrayBufferList* GetThreadSharedChannelsForRate(JSContext* aContext,
uint32_t* aRate,
uint32_t* aLength);
ThreadSharedFloatArrayBufferList* GetThreadSharedChannelsForRate(JSContext* aContext);
// aContents should either come from JS_AllocateArrayBufferContents or
// JS_StealArrayBufferContents.

View File

@ -457,10 +457,10 @@ AudioBufferSourceNode::Start(JSContext* aCx, double aWhen, double aOffset,
return;
}
uint32_t rate;
uint32_t lengthSamples;
float rate = mBuffer->SampleRate();
int32_t lengthSamples = mBuffer->Length();
nsRefPtr<ThreadSharedFloatArrayBufferList> data =
mBuffer->GetThreadSharedChannelsForRate(aCx, &rate, &lengthSamples);
mBuffer->GetThreadSharedChannelsForRate(aCx);
double length = double(lengthSamples) / rate;
double offset = std::max(0.0, aOffset);
double endOffset = aDuration.WasPassed() ?

View File

@ -13,7 +13,6 @@
#include "AudioProcessingEvent.h"
#include "WebAudioUtils.h"
#include "mozilla/Mutex.h"
#include "mozilla/unused.h"
#include "mozilla/PodOperations.h"
#include <deque>
@ -304,10 +303,7 @@ private:
// Steal the output buffers
nsRefPtr<ThreadSharedFloatArrayBufferList> output;
if (event->HasOutputBuffer()) {
uint32_t rate, length;
output = event->OutputBuffer()->GetThreadSharedChannelsForRate(cx, &rate, &length);
unused << rate;
unused << length;
output = event->OutputBuffer()->GetThreadSharedChannelsForRate(cx);
}
// Append it to our output buffer queue