Commit 84126a36 authored by rtoy@chromium.org's avatar rtoy@chromium.org

OfflineAudioContext should support up to 32 channels.

Previously, only 10 channels were supported for an
OfflineAudioContext. Although the WebAudio specification doesn't explicitly say
what the limit is, generally at least 32 channels are required to be
supported for all nodes.

Added a test that creating an offline context with 32 channels works.

BUG=362133

Review URL: https://codereview.chromium.org/232843004

git-svn-id: svn://svn.chromium.org/blink/trunk@171480 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 763cce00
...@@ -45,7 +45,8 @@ PASS node.channelCount = 99 threw exception NotSupportedError: Failed to set the ...@@ -45,7 +45,8 @@ PASS node.channelCount = 99 threw exception NotSupportedError: Failed to set the
PASS node.channelCountMode = mode threw exception InvalidStateError: Failed to set the 'channelCountMode' property on 'AudioNode': invalid mode 'fancy'; must be 'max', 'clamped-max', or 'explicit'.. PASS node.channelCountMode = mode threw exception InvalidStateError: Failed to set the 'channelCountMode' property on 'AudioNode': invalid mode 'fancy'; must be 'max', 'clamped-max', or 'explicit'..
PASS node.channelInterpretation = mode threw exception InvalidStateError: Failed to set the 'channelInterpretation' property on 'AudioNode': invalid interpretation 'fancy'; must be 'speakers' or 'discrete'.. PASS node.channelInterpretation = mode threw exception InvalidStateError: Failed to set the 'channelInterpretation' property on 'AudioNode': invalid interpretation 'fancy'; must be 'speakers' or 'discrete'..
PASS context.destination.channelCount = 99 threw exception IndexSizeError: Failed to set the 'channelCount' property on 'AudioNode': The channel count provided (99) is outside the range [1, 2].. PASS context.destination.channelCount = 99 threw exception IndexSizeError: Failed to set the 'channelCount' property on 'AudioNode': The channel count provided (99) is outside the range [1, 2]..
PASS new OfflineAudioContext(99, 100, context.sampleRate) threw exception SyntaxError: Failed to construct 'OfflineAudioContext': number of channels (99) exceeds maximum (10).. PASS new OfflineAudioContext(32, 100, context.sampleRate) did not throw exception.
PASS new OfflineAudioContext(99, 100, context.sampleRate) threw exception IndexSizeError: Failed to construct 'OfflineAudioContext': The number of channels provided (99) is outside the range [0, 32]..
PASS new OfflineAudioContext(1, 100, 1) threw exception SyntaxError: Failed to construct 'OfflineAudioContext': sample rate (1) must be in the range 44100-96000 Hz.. PASS new OfflineAudioContext(1, 100, 1) threw exception SyntaxError: Failed to construct 'OfflineAudioContext': sample rate (1) must be in the range 44100-96000 Hz..
PASS new OfflineAudioContext(1, 100, 1e6) threw exception SyntaxError: Failed to construct 'OfflineAudioContext': sample rate (1.00000e+6) must be in the range 44100-96000 Hz.. PASS new OfflineAudioContext(1, 100, 1e6) threw exception SyntaxError: Failed to construct 'OfflineAudioContext': sample rate (1.00000e+6) must be in the range 44100-96000 Hz..
PASS new OfflineAudioContext(1, -88200000000000, 44100) threw exception NotSupportedError: Failed to construct 'OfflineAudioContext': OfflineAudioContext(1, 1448390656, 44100). PASS new OfflineAudioContext(1, -88200000000000, 44100) threw exception NotSupportedError: Failed to construct 'OfflineAudioContext': OfflineAudioContext(1, 1448390656, 44100).
......
...@@ -113,6 +113,8 @@ function runTest() { ...@@ -113,6 +113,8 @@ function runTest() {
// Delay nodes are tested elsewhere, so don't duplicate that work here. // Delay nodes are tested elsewhere, so don't duplicate that work here.
// OfflineAudioContext // OfflineAudioContext
// Max supported channels
shouldNotThrow("new OfflineAudioContext(32, 100, context.sampleRate)");
// Invalid number of channels (unspecified error) // Invalid number of channels (unspecified error)
shouldThrow("new OfflineAudioContext(99, 100, context.sampleRate)"); shouldThrow("new OfflineAudioContext(99, 100, context.sampleRate)");
// Invalid sample rate. (unspecified error) // Invalid sample rate. (unspecified error)
......
...@@ -53,8 +53,16 @@ PassRefPtr<OfflineAudioContext> OfflineAudioContext::create(ExecutionContext* co ...@@ -53,8 +53,16 @@ PassRefPtr<OfflineAudioContext> OfflineAudioContext::create(ExecutionContext* co
return nullptr; return nullptr;
} }
if (numberOfChannels > 10) { if (numberOfChannels > AudioContext::maxNumberOfChannels()) {
exceptionState.throwDOMException(SyntaxError, "number of channels (" + String::number(numberOfChannels) + ") exceeds maximum (10)."); exceptionState.throwDOMException(
IndexSizeError,
ExceptionMessages::indexOutsideRange<unsigned>(
"number of channels",
numberOfChannels,
0,
ExceptionMessages::InclusiveBound,
AudioContext::maxNumberOfChannels(),
ExceptionMessages::InclusiveBound));
return nullptr; return nullptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment