author | Dan Minor <dminor@mozilla.com> |
Tue, 26 Apr 2016 09:41:54 -0400 | |
changeset 294945 | b165d4c2ee468a5032230a72195d7d7701edfa23 |
parent 294944 | 910c7dab253e756fe182ceea84ccff369535cbe4 |
child 294946 | a6e1c4c2b2c41d50d6dde946e6f359643ea51307 |
push id | 75738 |
push user | dminor@mozilla.com |
push date | Tue, 26 Apr 2016 15:49:20 +0000 |
treeherder | mozilla-inbound@a6e1c4c2b2c4 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | padenot |
bugs | 1267579, 1222405 |
milestone | 49.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
|
--- a/dom/media/webaudio/blink/PeriodicWave.cpp +++ b/dom/media/webaudio/blink/PeriodicWave.cpp @@ -148,17 +148,19 @@ void PeriodicWave::waveDataForFundamenta // to the positive frequency. fundamentalFrequency = fabsf(fundamentalFrequency); // We only need to rebuild to the tables if the new fundamental // frequency is low enough to allow for more partials below the // Nyquist frequency. unsigned numberOfPartials = numberOfPartialsForRange(0); float nyquist = 0.5 * m_sampleRate; - numberOfPartials = std::min(numberOfPartials, (unsigned)(nyquist / fundamentalFrequency)); + if (fundamentalFrequency != 0.0) { + numberOfPartials = std::min(numberOfPartials, (unsigned)(nyquist / fundamentalFrequency)); + } if (numberOfPartials > m_maxPartialsInBandLimitedTable) { for (unsigned rangeIndex = 0; rangeIndex < m_numberOfRanges; ++rangeIndex) { m_bandLimitedTables[rangeIndex] = 0; } // We need to create the first table to determine the normalization // constant. createBandLimitedTables(fundamentalFrequency, 0); @@ -235,18 +237,20 @@ void PeriodicWave::createBandLimitedTabl // partials for this pitch range. We need to clear out the highest // frequencies to band-limit the waveform. unsigned numberOfPartials = numberOfPartialsForRange(rangeIndex); // Also limit to the number of components that are provided. numberOfPartials = std::min(numberOfPartials, m_numberOfComponents - 1); // Limit number of partials to those below Nyquist frequency float nyquist = 0.5 * m_sampleRate; - numberOfPartials = std::min(numberOfPartials, - (unsigned)(nyquist / fundamentalFrequency)); + if (fundamentalFrequency != 0.0) { + numberOfPartials = std::min(numberOfPartials, + (unsigned)(nyquist / fundamentalFrequency)); + } // Copy from loaded frequency data and generate complex conjugate // because of the way the inverse FFT is defined. // The coefficients of higher partials remain zero, as initialized in // the FFTBlock constructor. for (i = 0; i < numberOfPartials + 1; ++i) { frame.RealData(i) = realData[i]; frame.ImagData(i) = -imagData[i];