Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.cpp

Issue 2394953002: ChannelSplitterNode channelCount and mode are constant (Closed)
Patch Set: Rebase and fix incorrect comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.cpp b/third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.cpp
index 4408762461231e8b8b3d4746942cb44c50e72558..33826829ad18a90ef7c1ce07722d48195a0b81ea 100644
--- a/third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.cpp
@@ -38,6 +38,9 @@ ChannelSplitterHandler::ChannelSplitterHandler(AudioNode& node,
float sampleRate,
unsigned numberOfOutputs)
: AudioHandler(NodeTypeChannelSplitter, node, sampleRate) {
+ // These properties are fixed and cannot be changed by the user.
+ m_channelCount = numberOfOutputs;
+ setInternalChannelCountMode(Explicit);
addInput();
// Create a fixed number of outputs (able to handle the maximum number of
@@ -79,6 +82,34 @@ void ChannelSplitterHandler::process(size_t framesToProcess) {
}
}
+void ChannelSplitterHandler::setChannelCount(unsigned long channelCount,
+ ExceptionState& exceptionState) {
+ DCHECK(isMainThread());
+ BaseAudioContext::AutoLocker locker(context());
+
+ // channelCount cannot be changed from the number of outputs.
+ if (channelCount != numberOfOutputs()) {
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "ChannelSplitter: channelCount cannot be changed from " +
+ String::number(numberOfOutputs()));
+ }
+}
+
+void ChannelSplitterHandler::setChannelCountMode(
+ const String& mode,
+ ExceptionState& exceptionState) {
+ DCHECK(isMainThread());
+ BaseAudioContext::AutoLocker locker(context());
+
+ // channcelCountMode must be 'explicit'.
+ if (mode != "explicit") {
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "ChannelSplitter: channelCountMode cannot be changed from 'explicit'");
+ }
+}
+
// ----------------------------------------------------------------
ChannelSplitterNode::ChannelSplitterNode(BaseAudioContext& context,
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/ChannelSplitterNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698