bug 1388656 re-initialize the Reverb only once when the ConvolverNode buffer changes
MozReview-Commit-ID: IKMK5GYVRBB
--- a/dom/media/webaudio/ConvolverNode.cpp
+++ b/dom/media/webaudio/ConvolverNode.cpp
@@ -61,30 +61,27 @@ public:
NS_ERROR("Bad ConvolverNodeEngine Int32Parameter");
}
}
void SetDoubleParameter(uint32_t aIndex, double aParam) override
{
switch (aIndex) {
case SAMPLE_RATE:
mSampleRate = aParam;
- AdjustReverb();
+ // The buffer is passed after the sample rate.
+ // mReverb will be set using this sample rate when the buffer is received.
break;
default:
NS_ERROR("Bad ConvolverNodeEngine DoubleParameter");
}
}
void SetBuffer(already_AddRefed<ThreadSharedFloatArrayBufferList> aBuffer) override
{
mBuffer = aBuffer;
- AdjustReverb();
- }
- void AdjustReverb()
- {
// Note about empirical tuning (this is copied from Blink)
// The maximum FFT size affects reverb performance and accuracy.
// If the reverb is single-threaded and processes entirely in the real-time audio thread,
// it's important not to make this too high. In this case 8192 is a good value.
// But, the Reverb object is multi-threaded, so we want this as high as possible without losing too much accuracy.
// Very large FFTs will have worse phase errors. Given these constraints 32768 is a good compromise.
const size_t MaxFFTSize = 32768;