Title: [191572] releases/WebKitGTK/webkit-2.10
Revision
191572
Author
[email protected]
Date
2015-10-26 01:47:11 -0700 (Mon, 26 Oct 2015)

Log Message

Merge r191492 - ConvolverNode.buffer must have same sample-rate as the AudioContext
https://bugs.webkit.org/show_bug.cgi?id=150385

Patch by Hyemi Shin <[email protected]> on 2015-10-23
Reviewed by Chris Dumez.

ConvolverNode.buffer must be of the same sample-rate as the AudioContext
or an NOT_SUPPORTED_ERR exception MUST be thrown.

Test : webaudio/convolver-setBuffer-different-samplerate.html

* Modules/webaudio/ConvolverNode.cpp:
(WebCore::ConvolverNode::setBuffer):
* Modules/webaudio/ConvolverNode.h:
* Modules/webaudio/ConvolverNode.idl:

LayoutTests:
ConvolverNode.buffer must have same sample rate as the AudioContext
https://bugs.webkit.org/show_bug.cgi?id=150385

Patch by Hyemi Shin <[email protected]> on 2015-10-23
Reviewed by Chris Dumez.

* webaudio/convolver-setBuffer-different-samplerate-expected.txt: Added.
* webaudio/convolver-setBuffer-different-samplerate.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (191571 => 191572)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-10-26 08:37:20 UTC (rev 191571)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog	2015-10-26 08:47:11 UTC (rev 191572)
@@ -1,3 +1,13 @@
+2015-10-23  Hyemi Shin  <[email protected]>
+
+        ConvolverNode.buffer must have same sample rate as the AudioContext
+        https://bugs.webkit.org/show_bug.cgi?id=150385
+
+        Reviewed by Chris Dumez.
+
+        * webaudio/convolver-setBuffer-different-samplerate-expected.txt: Added.
+        * webaudio/convolver-setBuffer-different-samplerate.html: Added.
+
 2015-10-21  Dean Jackson  <[email protected]>
 
         Null dereference loading Blink layout test svg/filters/display-none-filter-primitive.html

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/webaudio/convolver-setBuffer-different-samplerate-expected.txt (0 => 191572)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/webaudio/convolver-setBuffer-different-samplerate-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/webaudio/convolver-setBuffer-different-samplerate-expected.txt	2015-10-26 08:47:11 UTC (rev 191572)
@@ -0,0 +1,11 @@
+Tests that ConvolverNode buffer rate must match context rate.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS convolver.buffer = context.createBuffer(1, 256, 22050) threw exception Error: NotSupportedError: DOM Exception 9.
+PASS convolver.buffer = context.createBuffer(1, 256, 44100) did not throw exception.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: releases/WebKitGTK/webkit-2.10/LayoutTests/webaudio/convolver-setBuffer-different-samplerate.html (0 => 191572)


--- releases/WebKitGTK/webkit-2.10/LayoutTests/webaudio/convolver-setBuffer-different-samplerate.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/webaudio/convolver-setBuffer-different-samplerate.html	2015-10-26 08:47:11 UTC (rev 191572)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+
+<body>
+<script>
+description("Tests that ConvolverNode buffer rate must match context rate.");
+
+var context = new webkitOfflineAudioContext(1, 256, 44100);
+var convolver = context.createConvolver();
+
+shouldThrow("convolver.buffer = context.createBuffer(1, 256, 22050)", "'Error: NotSupportedError: DOM Exception 9'");
+shouldNotThrow("convolver.buffer = context.createBuffer(1, 256, 44100)");
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (191571 => 191572)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-10-26 08:37:20 UTC (rev 191571)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog	2015-10-26 08:47:11 UTC (rev 191572)
@@ -1,3 +1,20 @@
+2015-10-23  Hyemi Shin  <[email protected]>
+
+        ConvolverNode.buffer must have same sample-rate as the AudioContext 
+        https://bugs.webkit.org/show_bug.cgi?id=150385 
+
+        Reviewed by Chris Dumez.
+
+        ConvolverNode.buffer must be of the same sample-rate as the AudioContext
+        or an NOT_SUPPORTED_ERR exception MUST be thrown.
+
+        Test : webaudio/convolver-setBuffer-different-samplerate.html
+
+        * Modules/webaudio/ConvolverNode.cpp:
+        (WebCore::ConvolverNode::setBuffer):
+        * Modules/webaudio/ConvolverNode.h:
+        * Modules/webaudio/ConvolverNode.idl:
+
 2015-10-22  Ryosuke Niwa  <[email protected]>
 
         REGRESSION (r181972): Scroll position changes to top of youtube page when switching tabs

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.cpp (191571 => 191572)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.cpp	2015-10-26 08:37:20 UTC (rev 191571)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.cpp	2015-10-26 08:47:11 UTC (rev 191572)
@@ -32,6 +32,7 @@
 #include "AudioContext.h"
 #include "AudioNodeInput.h"
 #include "AudioNodeOutput.h"
+#include "ExceptionCode.h"
 #include "Reverb.h"
 #include <wtf/MainThread.h>
 
@@ -115,13 +116,18 @@
     AudioNode::uninitialize();
 }
 
-void ConvolverNode::setBuffer(AudioBuffer* buffer)
+void ConvolverNode::setBuffer(AudioBuffer* buffer, ExceptionCode& ec)
 {
     ASSERT(isMainThread());
     
     if (!buffer)
         return;
 
+    if (buffer->sampleRate() != context()->sampleRate()) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
     unsigned numberOfChannels = buffer->numberOfChannels();
     size_t bufferLength = buffer->length();
 

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.h (191571 => 191572)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.h	2015-10-26 08:37:20 UTC (rev 191571)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.h	2015-10-26 08:47:11 UTC (rev 191572)
@@ -51,7 +51,7 @@
     virtual void uninitialize() override;
 
     // Impulse responses
-    void setBuffer(AudioBuffer*);
+    void setBuffer(AudioBuffer*, ExceptionCode&);
     AudioBuffer* buffer();
 
     bool normalize() const { return m_normalize; }

Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.idl (191571 => 191572)


--- releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.idl	2015-10-26 08:37:20 UTC (rev 191571)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/Modules/webaudio/ConvolverNode.idl	2015-10-26 08:47:11 UTC (rev 191572)
@@ -27,6 +27,6 @@
     Conditional=WEB_AUDIO,
     JSGenerateToJSObject
 ] interface ConvolverNode : AudioNode {
-    attribute AudioBuffer buffer;
+    [SetterRaisesException] attribute AudioBuffer buffer;
     attribute boolean normalize;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to