Bug 1131529 - Update the maximum FFT size in AnalyserNode to be 2^15. r=padenot

This commit is contained in:
Ankit Goyal 2015-02-16 16:03:07 +01:00
parent c674baae5b
commit 430745d9af
2 changed files with 15 additions and 3 deletions

View File

@ -120,9 +120,9 @@ AnalyserNode::WrapObject(JSContext* aCx)
void
AnalyserNode::SetFftSize(uint32_t aValue, ErrorResult& aRv)
{
// Disallow values that are not a power of 2 and outside the [32,2048] range
// Disallow values that are not a power of 2 and outside the [32,32768] range
if (aValue < 32 ||
aValue > 2048 ||
aValue > 32768 ||
(aValue & (aValue - 1)) != 0) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;

View File

@ -52,7 +52,19 @@ addLoadEvent(function() {
analyser.fftSize = 2049;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 4096;
analyser.fftSize = 4097;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 8193;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 16385;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 32769;
}, DOMException.INDEX_SIZE_ERR);
expectException(function() {
analyser.fftSize = 65536;
}, DOMException.INDEX_SIZE_ERR);
analyser.fftSize = 1024;
is(analyser.frequencyBinCount, 512, "Correct new value for frequencyBinCount");