From 3bc589b269e8180e314b15850dc14e31dde91b2c Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Wed, 4 Nov 2015 08:40:12 +1300 Subject: [PATCH] bug 1221833 replace initial direct convolution stage with fft r=padenot --HG-- extra : rebase_source : 2cc20db26a95b56683d24853622fbe3cac016b45 --- dom/media/webaudio/blink/ReverbConvolver.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dom/media/webaudio/blink/ReverbConvolver.cpp b/dom/media/webaudio/blink/ReverbConvolver.cpp index 929f392abcc5..aae6aacfc81b 100644 --- a/dom/media/webaudio/blink/ReverbConvolver.cpp +++ b/dom/media/webaudio/blink/ReverbConvolver.cpp @@ -83,7 +83,8 @@ ReverbConvolver::ReverbConvolver(const float* impulseResponseData, const float* response = impulseResponseData; size_t totalResponseLength = impulseResponseLength; - // The total latency is zero because the direct-convolution is used in the leading portion. + // The total latency is zero because the first FFT stage is small enough + // to return output in the first block. size_t reverbTotalLatency = 0; size_t stageOffset = 0; @@ -100,7 +101,7 @@ ReverbConvolver::ReverbConvolver(const float* impulseResponseData, // This "staggers" the time when each FFT happens so they don't all happen at the same time int renderPhase = convolverRenderPhase + stagePhase; - bool useDirectConvolver = !stageOffset; + bool useDirectConvolver = false; nsAutoPtr stage (new ReverbConvolverStage(response, totalResponseLength, @@ -116,13 +117,13 @@ ReverbConvolver::ReverbConvolver(const float* impulseResponseData, } else m_stages.AppendElement(stage.forget()); - stageOffset += stageSize; - - if (!useDirectConvolver) { + if (stageOffset != 0) { // Figure out next FFT size fftSize *= 2; } + stageOffset += stageSize; + if (hasRealtimeConstraint && !isBackgroundStage && fftSize > m_maxRealtimeFFTSize) { fftSize = m_maxRealtimeFFTSize;