| Index: third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp
|
| diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp
|
| index 29fb96a68bbff989771eedb476e651c3f2699bf4..f56b0d0ad07fc029926941d03d5112e44454a596 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp
|
| +++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp
|
| @@ -28,6 +28,7 @@
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "modules/webaudio/AudioNodeInput.h"
|
| +#include "modules/webaudio/AudioNodeOptions.h"
|
| #include "modules/webaudio/BaseAudioContext.h"
|
| #include "platform/UUID.h"
|
| #include "platform/mediastream/MediaStreamCenter.h"
|
| @@ -115,9 +116,9 @@ void MediaStreamAudioDestinationHandler::setChannelCount(
|
| // which is constrained by m_source (WebAudioCapturereSource). Although
|
| // it has its own safety check for the excessive channels, throwing an
|
| // exception here is useful to developers.
|
| - if (channelCount > maxChannelCount()) {
|
| + if (channelCount < 1 || channelCount > maxChannelCount()) {
|
| exceptionState.throwDOMException(
|
| - IndexSizeError,
|
| + NotSupportedError,
|
| ExceptionMessages::indexOutsideRange<unsigned>(
|
| "channel count", channelCount, 1, ExceptionMessages::InclusiveBound,
|
| maxChannelCount(), ExceptionMessages::InclusiveBound));
|
| @@ -159,6 +160,31 @@ MediaStreamAudioDestinationNode* MediaStreamAudioDestinationNode::create(
|
| return new MediaStreamAudioDestinationNode(context, numberOfChannels);
|
| }
|
|
|
| +MediaStreamAudioDestinationNode* MediaStreamAudioDestinationNode::create(
|
| + BaseAudioContext* context,
|
| + const AudioNodeOptions& options,
|
| + ExceptionState& exceptionState) {
|
| + DCHECK(isMainThread());
|
| +
|
| + // Default to stereo; |options| will update it approriately if needed.
|
| + MediaStreamAudioDestinationNode* node =
|
| + new MediaStreamAudioDestinationNode(*context, 2);
|
| +
|
| + if (!node)
|
| + return nullptr;
|
| +
|
| + // Need to handle channelCount here ourselves because the upper
|
| + // limit is different from the normal AudioNode::setChannelCount
|
| + // limit of 32. Error messages will sometimes show the wrong
|
| + // limits.
|
| + if (options.hasChannelCount())
|
| + node->setChannelCount(options.channelCount(), exceptionState);
|
| +
|
| + node->handleChannelOptions(options, exceptionState);
|
| +
|
| + return node;
|
| +}
|
| +
|
| MediaStream* MediaStreamAudioDestinationNode::stream() const {
|
| return static_cast<MediaStreamAudioDestinationHandler&>(handler()).stream();
|
| }
|
|
|