Title: [265347] trunk
Revision
265347
Author
cdu...@apple.com
Date
2020-08-06 14:13:13 -0700 (Thu, 06 Aug 2020)

Log Message

MediaStreamAudioDestinationNode should have a constructor
https://bugs.webkit.org/show_bug.cgi?id=215233

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

* web-platform-tests/webaudio/idlharness.https.window-expected.txt:
* web-platform-tests/webaudio/the-audio-api/the-mediastreamaudiodestinationnode-interface/ctor-mediastreamaudiodestination-expected.txt:

Source/WebCore:

MediaStreamAudioDestinationNode should have a constructor:
- https://webaudio.github.io/web-audio-api/#mediastreamaudiodestinationnode

No new tests, rebaselined existing tests.

* Modules/webaudio/AnalyserNode.cpp:
(WebCore::AnalyserNode::AnalyserNode):
* Modules/webaudio/AudioBasicInspectorNode.cpp:
(WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
(WebCore::AudioBasicInspectorNode::pullInputs):
(WebCore::AudioBasicInspectorNode::checkNumberOfChannelsForInput):
(WebCore::AudioBasicInspectorNode::updatePullStatus):
* Modules/webaudio/AudioBasicInspectorNode.h:
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createMediaStreamDestination):
* Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
(WebCore::MediaStreamAudioDestinationNode::create):
(WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
* Modules/webaudio/MediaStreamAudioDestinationNode.h:
* Modules/webaudio/MediaStreamAudioDestinationNode.idl:
* Modules/webaudio/WebKitAudioContext.cpp:
(WebCore::WebKitAudioContext::createMediaStreamDestination):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265346 => 265347)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-06 21:13:13 UTC (rev 265347)
@@ -1,5 +1,17 @@
 2020-08-06  Chris Dumez  <cdu...@apple.com>
 
+        MediaStreamAudioDestinationNode should have a constructor
+        https://bugs.webkit.org/show_bug.cgi?id=215233
+
+        Reviewed by Geoffrey Garen.
+
+        Rebaseline WPT tests now that more checks are passing.
+
+        * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+        * web-platform-tests/webaudio/the-audio-api/the-mediastreamaudiodestinationnode-interface/ctor-mediastreamaudiodestination-expected.txt:
+
+2020-08-06  Chris Dumez  <cdu...@apple.com>
+
         MediaStreamAudioSourceNode should have a constructor
         https://bugs.webkit.org/show_bug.cgi?id=215225
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (265346 => 265347)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt	2020-08-06 21:13:13 UTC (rev 265347)
@@ -822,38 +822,38 @@
 PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelCountMode" with the proper type 
 PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelInterpretation" with the proper type 
 PASS MediaStreamAudioDestinationNode interface: existence and properties of interface object 
-FAIL MediaStreamAudioDestinationNode interface object length assert_equals: wrong value for MediaStreamAudioDestinationNode.length expected 1 but got 0
+PASS MediaStreamAudioDestinationNode interface object length 
 PASS MediaStreamAudioDestinationNode interface object name 
 PASS MediaStreamAudioDestinationNode interface: existence and properties of interface prototype object 
 PASS MediaStreamAudioDestinationNode interface: existence and properties of interface prototype object's "constructor" property 
 PASS MediaStreamAudioDestinationNode interface: existence and properties of interface prototype object's @@unscopables property 
 PASS MediaStreamAudioDestinationNode interface: attribute stream 
-FAIL MediaStreamAudioDestinationNode must be primary interface of new MediaStreamAudioDestinationNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL Stringification of new MediaStreamAudioDestinationNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL MediaStreamAudioDestinationNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "stream" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling connect(AudioParam, optional unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling disconnect(unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioNode)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioParam)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam, unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "context" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "numberOfInputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "numberOfOutputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "channelCount" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
-FAIL AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaStreamAudioDestinationNode(context)')"
+PASS MediaStreamAudioDestinationNode must be primary interface of new MediaStreamAudioDestinationNode(context) 
+PASS Stringification of new MediaStreamAudioDestinationNode(context) 
+PASS MediaStreamAudioDestinationNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "stream" with the proper type 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type 
+PASS AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type 
+PASS AudioNode interface: calling connect(AudioParam, optional unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect()" with the proper type 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioNode)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioParam)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioParam) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type 
+PASS AudioNode interface: calling disconnect(AudioParam, unsigned long) on new MediaStreamAudioDestinationNode(context) with too few arguments must throw TypeError 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "context" with the proper type 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "numberOfInputs" with the proper type 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "numberOfOutputs" with the proper type 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "channelCount" with the proper type 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "channelCountMode" with the proper type 
+PASS AudioNode interface: new MediaStreamAudioDestinationNode(context) must inherit property "channelInterpretation" with the proper type 
 PASS MediaStreamAudioSourceNode interface: existence and properties of interface object 
 PASS MediaStreamAudioSourceNode interface object length 
 PASS MediaStreamAudioSourceNode interface object name 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediastreamaudiodestinationnode-interface/ctor-mediastreamaudiodestination-expected.txt (265346 => 265347)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediastreamaudiodestinationnode-interface/ctor-mediastreamaudiodestination-expected.txt	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediastreamaudiodestinationnode-interface/ctor-mediastreamaudiodestination-expected.txt	2020-08-06 21:13:13 UTC (rev 265347)
@@ -2,21 +2,47 @@
 PASS # AUDIT TASK RUNNER STARTED. 
 PASS Executing "initialize" 
 PASS Executing "invalid constructor" 
-FAIL Executing "default constructor" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.numberOfInputs')"
-FAIL Executing "test AudioNodeOptions" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.channelCount')"
+PASS Executing "default constructor" 
+PASS Executing "test AudioNodeOptions" 
 PASS Audit report 
 PASS > [initialize]  
 PASS   context = new AudioContext() did not throw an exception. 
 PASS < [initialize] All assertions passed. (total 1 assertions) 
 PASS > [invalid constructor]  
-PASS   new MediaStreamAudioDestinationNode() threw TypeError: "function is not a constructor (evaluating 'new window[name]()')". 
-PASS   new MediaStreamAudioDestinationNode(1) threw TypeError: "function is not a constructor (evaluating 'new window[name](1)')". 
-PASS   new MediaStreamAudioDestinationNode(context, 42) threw TypeError: "function is not a constructor (evaluating 'new window[name](context, 42)')". 
+PASS   new MediaStreamAudioDestinationNode() threw TypeError: "Not enough arguments". 
+PASS   new MediaStreamAudioDestinationNode(1) threw TypeError: "Argument 1 ('context') to the MediaStreamAudioDestinationNode constructor must be an instance of AudioContext". 
+PASS   new MediaStreamAudioDestinationNode(context, 42) threw TypeError: "Type error". 
 PASS < [invalid constructor] All assertions passed. (total 3 assertions) 
 PASS > [default constructor]  
-FAIL X node0 = new MediaStreamAudioDestinationNode(context) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[name](context, options.constructorOptions)')". assert_true: expected true got false
-FAIL X node0 instanceof MediaStreamAudioDestinationNode is not equal to true. Got false. assert_true: expected true got false
+PASS   node0 = new MediaStreamAudioDestinationNode(context) did not throw an exception. 
+PASS   node0 instanceof MediaStreamAudioDestinationNode is equal to true. 
+PASS   node0.numberOfInputs is equal to 1. 
+PASS   node0.numberOfOutputs is equal to 0. 
+PASS   node0.channelCount is equal to 2. 
+PASS   node0.channelCountMode is equal to explicit. 
+PASS   node0.channelInterpretation is equal to speakers. 
+PASS < [default constructor] All assertions passed. (total 7 assertions) 
 PASS > [test AudioNodeOptions]  
-FAIL X new MediaStreamAudioDestinationNode(c, {channelCount: 7}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[nodeName]')". assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 2 out of 4 tasks were failed. assert_true: expected true got false
+PASS   new MediaStreamAudioDestinationNode(c, {channelCount: 7}) did not throw an exception. 
+PASS   node.channelCount is equal to 7. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelCount: 0}) threw InvalidStateError: "The object is in an invalid state.". 
+PASS   new MediaStreamAudioDestinationNode(c, {channelCount: 99}) threw InvalidStateError: "The object is in an invalid state.". 
+PASS   new MediaStreamAudioDestinationNode(c, {channelCountMode: "max"} did not throw an exception. 
+PASS   node.channelCountMode is equal to max. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelCountMode: "max"}) did not throw an exception. 
+PASS   node.channelCountMode after valid setter is equal to max. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelCountMode: "clamped-max"}) did not throw an exception. 
+PASS   node.channelCountMode after valid setter is equal to clamped-max. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelCountMode: "explicit"}) did not throw an exception. 
+PASS   node.channelCountMode after valid setter is equal to explicit. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelCountMode: "foobar"} threw TypeError: "Type error". 
+PASS   node.channelCountMode after invalid setter is equal to explicit. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelInterpretation: "speakers"}) did not throw an exception. 
+PASS   node.channelInterpretation is equal to speakers. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelInterpretation: "discrete"}) did not throw an exception. 
+PASS   node.channelInterpretation is equal to discrete. 
+PASS   new MediaStreamAudioDestinationNode(c, {channelInterpretation: "foobar"}) threw TypeError: "Type error". 
+PASS   node.channelInterpretation after invalid setter is equal to discrete. 
+PASS < [test AudioNodeOptions] All assertions passed. (total 20 assertions) 
+PASS # AUDIT TASK RUNNER FINISHED: 4 tasks ran successfully. 
 

Modified: trunk/Source/WebCore/ChangeLog (265346 => 265347)


--- trunk/Source/WebCore/ChangeLog	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/ChangeLog	2020-08-06 21:13:13 UTC (rev 265347)
@@ -1,3 +1,33 @@
+2020-08-06  Chris Dumez  <cdu...@apple.com>
+
+        MediaStreamAudioDestinationNode should have a constructor
+        https://bugs.webkit.org/show_bug.cgi?id=215233
+
+        Reviewed by Geoffrey Garen.
+
+        MediaStreamAudioDestinationNode should have a constructor:
+        - https://webaudio.github.io/web-audio-api/#mediastreamaudiodestinationnode
+
+        No new tests, rebaselined existing tests.
+
+        * Modules/webaudio/AnalyserNode.cpp:
+        (WebCore::AnalyserNode::AnalyserNode):
+        * Modules/webaudio/AudioBasicInspectorNode.cpp:
+        (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
+        (WebCore::AudioBasicInspectorNode::pullInputs):
+        (WebCore::AudioBasicInspectorNode::checkNumberOfChannelsForInput):
+        (WebCore::AudioBasicInspectorNode::updatePullStatus):
+        * Modules/webaudio/AudioBasicInspectorNode.h:
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::createMediaStreamDestination):
+        * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
+        (WebCore::MediaStreamAudioDestinationNode::create):
+        (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
+        * Modules/webaudio/MediaStreamAudioDestinationNode.h:
+        * Modules/webaudio/MediaStreamAudioDestinationNode.idl:
+        * Modules/webaudio/WebKitAudioContext.cpp:
+        (WebCore::WebKitAudioContext::createMediaStreamDestination):
+
 2020-08-06  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         [CG] Avoid creating a sub-image when drawing a small scaled sub-rect from a native image

Modified: trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/AnalyserNode.cpp	2020-08-06 21:13:13 UTC (rev 265347)
@@ -65,9 +65,10 @@
 }
 
 AnalyserNode::AnalyserNode(BaseAudioContext& context)
-    : AudioBasicInspectorNode(context, context.sampleRate(), 2)
+    : AudioBasicInspectorNode(context, context.sampleRate())
 {
     setNodeType(NodeTypeAnalyser);
+    addOutput(makeUnique<AudioNodeOutput>(this, 2));
     
     initialize();
 }

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp	2020-08-06 21:13:13 UTC (rev 265347)
@@ -36,12 +36,11 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(AudioBasicInspectorNode);
 
-AudioBasicInspectorNode::AudioBasicInspectorNode(BaseAudioContext& context, float sampleRate, unsigned outputChannelCount)
+AudioBasicInspectorNode::AudioBasicInspectorNode(BaseAudioContext& context, float sampleRate)
     : AudioNode(context, sampleRate)
 {
     setNodeType(NodeTypeBasicInspector);
     addInput(makeUnique<AudioNodeInput>(this));
-    addOutput(makeUnique<AudioNodeOutput>(this, outputChannelCount));
 }
 
 // We override pullInputs() as an optimization allowing this node to take advantage of in-place processing,
@@ -50,7 +49,8 @@
 void AudioBasicInspectorNode::pullInputs(size_t framesToProcess)
 {
     // Render input stream - try to render directly into output bus for pass-through processing where process() doesn't need to do anything...
-    input(0)->pull(output(0)->bus(), framesToProcess);
+    auto* output = this->output(0);
+    input(0)->pull(output ? output->bus() : nullptr, framesToProcess);
 }
 
 ExceptionOr<void> AudioBasicInspectorNode::connect(AudioNode& destination, unsigned outputIndex, unsigned inputIndex)
@@ -83,11 +83,13 @@
     if (input != this->input(0))
         return;
 
-    unsigned numberOfChannels = input->numberOfChannels();
+    if (auto* output = this->output(0)) {
+        unsigned numberOfChannels = input->numberOfChannels();
 
-    if (numberOfChannels != output(0)->numberOfChannels()) {
-        // This will propagate the channel count to any nodes connected further downstream in the graph.
-        output(0)->setNumberOfChannels(numberOfChannels);
+        if (numberOfChannels != output->numberOfChannels()) {
+            // This will propagate the channel count to any nodes connected further downstream in the graph.
+            output->setNumberOfChannels(numberOfChannels);
+        }
     }
 
     AudioNode::checkNumberOfChannelsForInput(input);
@@ -99,7 +101,8 @@
 {
     ASSERT(context().isGraphOwner());
 
-    if (output(0)->isConnected()) {
+    auto output = this->output(0);
+    if (output && output->isConnected()) {
         // When an AudioBasicInspectorNode is connected to a downstream node, it will get pulled by the
         // downstream node, thus remove it from the context's automatic pull list.
         if (m_needAutomaticPull) {

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h	2020-08-06 21:13:13 UTC (rev 265347)
@@ -34,7 +34,7 @@
 class AudioBasicInspectorNode : public AudioNode {
     WTF_MAKE_ISO_ALLOCATED(AudioBasicInspectorNode);
 public:
-    AudioBasicInspectorNode(BaseAudioContext&, float sampleRate, unsigned outputChannelCount);
+    AudioBasicInspectorNode(BaseAudioContext&, float sampleRate);
 
 private:
     void pullInputs(size_t framesToProcess) override;

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2020-08-06 21:13:13 UTC (rev 265347)
@@ -134,12 +134,7 @@
 
 ExceptionOr<Ref<MediaStreamAudioDestinationNode>> AudioContext::createMediaStreamDestination()
 {
-    if (isStopped())
-        return Exception { InvalidStateError };
-
-    // FIXME: Add support for an optional argument which specifies the number of channels.
-    // FIXME: The default should probably be stereo instead of mono.
-    return MediaStreamAudioDestinationNode::create(*this, 1);
+    return MediaStreamAudioDestinationNode::create(*this);
 }
 
 #endif

Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp	2020-08-06 21:13:13 UTC (rev 265347)
@@ -39,13 +39,24 @@
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(MediaStreamAudioDestinationNode);
 
-Ref<MediaStreamAudioDestinationNode> MediaStreamAudioDestinationNode::create(BaseAudioContext& context, size_t numberOfChannels)
+ExceptionOr<Ref<MediaStreamAudioDestinationNode>> MediaStreamAudioDestinationNode::create(BaseAudioContext& context, const AudioNodeOptions& options)
 {
-    return adoptRef(*new MediaStreamAudioDestinationNode(context, numberOfChannels));
+    if (context.isStopped())
+        return Exception { InvalidStateError };
+
+    context.lazyInitialize();
+
+    auto node = adoptRef(*new MediaStreamAudioDestinationNode(context));
+
+    auto result = node->handleAudioNodeOptions(options, { 2, ChannelCountMode::Explicit, ChannelInterpretation::Speakers });
+    if (result.hasException())
+        return result.releaseException();
+
+    return node;
 }
 
-MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(BaseAudioContext& context, size_t numberOfChannels)
-    : AudioBasicInspectorNode(context, context.sampleRate(), numberOfChannels)
+MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(BaseAudioContext& context)
+    : AudioBasicInspectorNode(context, context.sampleRate())
     , m_source(MediaStreamAudioSource::create(context.sampleRate()))
     , m_stream(MediaStream::create(*context.document(), MediaStreamPrivate::create(context.document()->logger(), m_source.copyRef())))
 {

Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.h (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.h	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.h	2020-08-06 21:13:13 UTC (rev 265347)
@@ -28,6 +28,7 @@
 
 #include "AudioBasicInspectorNode.h"
 #include "AudioBus.h"
+#include "AudioNodeOptions.h"
 #include "MediaStream.h"
 
 namespace WebCore {
@@ -38,7 +39,7 @@
 class MediaStreamAudioDestinationNode final : public AudioBasicInspectorNode {
     WTF_MAKE_ISO_ALLOCATED(MediaStreamAudioDestinationNode);
 public:
-    static Ref<MediaStreamAudioDestinationNode> create(BaseAudioContext&, size_t numberOfChannels);
+    static ExceptionOr<Ref<MediaStreamAudioDestinationNode>> create(BaseAudioContext&, const AudioNodeOptions& = { });
 
     virtual ~MediaStreamAudioDestinationNode();
 
@@ -49,7 +50,7 @@
     void reset() final;
     
 private:
-    MediaStreamAudioDestinationNode(BaseAudioContext&, size_t numberOfChannels);
+    explicit MediaStreamAudioDestinationNode(BaseAudioContext&);
 
     double tailTime() const final { return 0; }
     double latencyTime() const final { return 0; }

Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.idl (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.idl	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.idl	2020-08-06 21:13:13 UTC (rev 265347)
@@ -26,5 +26,6 @@
     Conditional=WEB_AUDIO&MEDIA_STREAM,
     JSGenerateToJSObject
 ] interface MediaStreamAudioDestinationNode : AudioNode {
+    [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, optional AudioNodeOptions options);
     readonly attribute MediaStream stream;
 };

Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp (265346 => 265347)


--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp	2020-08-06 21:02:12 UTC (rev 265346)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp	2020-08-06 21:13:13 UTC (rev 265347)
@@ -118,12 +118,7 @@
 
 ExceptionOr<Ref<MediaStreamAudioDestinationNode>> WebKitAudioContext::createMediaStreamDestination()
 {
-    if (isStopped())
-        return Exception { InvalidStateError };
-
-    // FIXME: Add support for an optional argument which specifies the number of channels.
-    // FIXME: The default should probably be stereo instead of mono.
-    return MediaStreamAudioDestinationNode::create(*this, 1);
+    return MediaStreamAudioDestinationNode::create(*this);
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to