Diff
Modified: trunk/LayoutTests/ChangeLog (265209 => 265210)
--- trunk/LayoutTests/ChangeLog 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/ChangeLog 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,3 +1,16 @@
+2020-08-03 Clark Wang <clark_w...@apple.com>
+
+ Added AudioBuffer Constructor
+ https://bugs.webkit.org/show_bug.cgi?id=214990
+
+ Reviewed by Chris Dumez.
+
+ Re-baselined existing tests. Some now fail due to unsupported sampleRate.
+
+ * TestExpectations:
+ * webaudio/audiobuffer-crash-expected.txt:
+ * webaudio/audiobuffersource-channels-expected.txt:
+
2020-08-03 Kenneth Russell <k...@chromium.org>
[WebGL2] webgl/2.0.0/conformance[2]/textures/image_bitmap* failures
Modified: trunk/LayoutTests/TestExpectations (265209 => 265210)
--- trunk/LayoutTests/TestExpectations 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/TestExpectations 2020-08-03 19:22:58 UTC (rev 265210)
@@ -321,6 +321,7 @@
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html [ Pass Failure ]
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping.html [ Pass Failure ]
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-scriptprocessornode-interface/simple-input-output.html [ Pass Failure ]
+imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform.html [ Pass Failure ]
webkit.org/b/176929 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay-with-slow-text-tracks.html [ Pass Failure ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,3 +1,22 @@
+2020-08-03 Clark Wang <clark_w...@apple.com>
+
+ Added AudioBuffer Constructor
+ https://bugs.webkit.org/show_bug.cgi?id=214990
+
+ Reviewed by Chris Dumez.
+
+ Re-baselined existing tests. Some now fail due to unsupported sampleRate.
+
+ * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt:
+
2020-08-03 Kenneth Russell <k...@chromium.org>
[WebGL2] webgl/2.0.0/conformance[2]/textures/image_bitmap* failures
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,5 +1,5 @@
-FAIL idl_test setup promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: 1, sampleRate: sample_rate})')"
+FAIL idl_test setup promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.audioWorklet.addModule')"
PASS idl_test validation
PASS HTMLElement includes GlobalEventHandlers: member names are unique
PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique
@@ -166,11 +166,11 @@
PASS OfflineAudioCompletionEvent interface: existence and properties of interface prototype object's "constructor" property
PASS OfflineAudioCompletionEvent interface: existence and properties of interface prototype object's @@unscopables property
PASS OfflineAudioCompletionEvent interface: attribute renderedBuffer
-FAIL OfflineAudioCompletionEvent must be primary interface of new OfflineAudioCompletionEvent("", {renderedBuffer: buffer}) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL Stringification of new OfflineAudioCompletionEvent("", {renderedBuffer: buffer}) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL OfflineAudioCompletionEvent interface: new OfflineAudioCompletionEvent("", {renderedBuffer: buffer}) must inherit property "renderedBuffer" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
+PASS OfflineAudioCompletionEvent must be primary interface of new OfflineAudioCompletionEvent("", {renderedBuffer: buffer})
+PASS Stringification of new OfflineAudioCompletionEvent("", {renderedBuffer: buffer})
+PASS OfflineAudioCompletionEvent interface: new OfflineAudioCompletionEvent("", {renderedBuffer: buffer}) must inherit property "renderedBuffer" with the proper type
PASS AudioBuffer interface: existence and properties of interface object
-FAIL AudioBuffer interface object length assert_equals: wrong value for AudioBuffer.length expected 1 but got 0
+PASS AudioBuffer interface object length
PASS AudioBuffer interface object name
PASS AudioBuffer interface: existence and properties of interface prototype object
PASS AudioBuffer interface: existence and properties of interface prototype object's "constructor" property
@@ -182,18 +182,18 @@
PASS AudioBuffer interface: operation getChannelData(unsigned long)
PASS AudioBuffer interface: operation copyFromChannel(Float32Array, unsigned long, optional unsigned long)
PASS AudioBuffer interface: operation copyToChannel(Float32Array, unsigned long, optional unsigned long)
-FAIL AudioBuffer must be primary interface of buffer assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL Stringification of buffer assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: buffer must inherit property "sampleRate" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: buffer must inherit property "length" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: buffer must inherit property "duration" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: buffer must inherit property "numberOfChannels" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: buffer must inherit property "getChannelData(unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: calling getChannelData(unsigned long) on buffer with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: buffer must inherit property "copyFromChannel(Float32Array, unsigned long, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: calling copyFromChannel(Float32Array, unsigned long, optional unsigned long) on buffer with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: buffer must inherit property "copyToChannel(Float32Array, unsigned long, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
-FAIL AudioBuffer interface: calling copyToChannel(Float32Array, unsigned long, optional unsigned long) on buffer with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
+PASS AudioBuffer must be primary interface of buffer
+PASS Stringification of buffer
+PASS AudioBuffer interface: buffer must inherit property "sampleRate" with the proper type
+PASS AudioBuffer interface: buffer must inherit property "length" with the proper type
+PASS AudioBuffer interface: buffer must inherit property "duration" with the proper type
+PASS AudioBuffer interface: buffer must inherit property "numberOfChannels" with the proper type
+PASS AudioBuffer interface: buffer must inherit property "getChannelData(unsigned long)" with the proper type
+PASS AudioBuffer interface: calling getChannelData(unsigned long) on buffer with too few arguments must throw TypeError
+PASS AudioBuffer interface: buffer must inherit property "copyFromChannel(Float32Array, unsigned long, optional unsigned long)" with the proper type
+PASS AudioBuffer interface: calling copyFromChannel(Float32Array, unsigned long, optional unsigned long) on buffer with too few arguments must throw TypeError
+PASS AudioBuffer interface: buffer must inherit property "copyToChannel(Float32Array, unsigned long, optional unsigned long)" with the proper type
+PASS AudioBuffer interface: calling copyToChannel(Float32Array, unsigned long, optional unsigned long) on buffer with too few arguments must throw TypeError
PASS AudioNode interface: existence and properties of interface object
PASS AudioNode interface object length
PASS AudioNode interface object name
@@ -443,19 +443,29 @@
PASS AudioProcessingEvent interface: attribute outputBuffer
FAIL AudioProcessingEvent must be primary interface of new AudioProcessingEvent('', {
playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
- }) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
+ }) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new AudioProcessingEvent('', {
+ playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
+ })')"
FAIL Stringification of new AudioProcessingEvent('', {
playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
- }) assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
+ }) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new AudioProcessingEvent('', {
+ playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
+ })')"
FAIL AudioProcessingEvent interface: new AudioProcessingEvent('', {
playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
- }) must inherit property "playbackTime" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
+ }) must inherit property "playbackTime" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new AudioProcessingEvent('', {
+ playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
+ })')"
FAIL AudioProcessingEvent interface: new AudioProcessingEvent('', {
playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
- }) must inherit property "inputBuffer" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
+ }) must inherit property "inputBuffer" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new AudioProcessingEvent('', {
+ playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
+ })')"
FAIL AudioProcessingEvent interface: new AudioProcessingEvent('', {
playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
- }) must inherit property "outputBuffer" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: buffer"
+ }) must inherit property "outputBuffer" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new AudioProcessingEvent('', {
+ playbackTime: 0, inputBuffer: buffer, outputBuffer: buffer
+ })')"
PASS BiquadFilterNode interface: existence and properties of interface object
FAIL BiquadFilterNode interface object length assert_equals: wrong value for BiquadFilterNode.length expected 1 but got 0
PASS BiquadFilterNode interface object name
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffer-interface/ctor-audiobuffer-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -2,36 +2,55 @@
PASS # AUDIT TASK RUNNER STARTED.
PASS Executing "initialize"
PASS Executing "invalid constructor"
-FAIL Executing "required options" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'buffer.numberOfChannels')"
+PASS Executing "required options"
PASS Executing "invalid option values"
FAIL Executing "default constructor" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'buffer.numberOfChannels')"
-FAIL Executing "valid constructor" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'buffer.numberOfChannels')"
-FAIL Executing "multiple contexts" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: 128, sampleRate: context.sampleRate})')"
+PASS Executing "valid constructor"
+FAIL Executing "multiple contexts" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBufferSourceNode(c1, {buffer: buffer})')"
PASS Audit report
PASS > [initialize]
PASS context = new OfflineAudioContext(...) did not throw an exception.
PASS < [initialize] All assertions passed. (total 1 assertions)
PASS > [invalid constructor]
-PASS new AudioBuffer() threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer()')".
-PASS new AudioBuffer(1) threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer(1)')".
-PASS new AudioBuffer(Date, 42) threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer(Date, 42)')".
+PASS new AudioBuffer() threw TypeError: "Not enough arguments".
+PASS new AudioBuffer(1) threw TypeError: "Type error".
+PASS new AudioBuffer(Date, 42) threw TypeError: "Member AudioBufferOptions.sampleRate is required and must be an instance of float".
PASS < [invalid constructor] All assertions passed. (total 3 assertions)
PASS > [required options]
-PASS buffer = new AudioBuffer({}) threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer({})')".
-PASS buffer = new AudioBuffer({length: 1}) threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer({length: 1})')".
-PASS buffer = new AudioBuffer({sampleRate: 48000}) threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer({sampleRate: 48000})')".
-PASS buffer = new AudioBuffer({numberOfChannels: 1} threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer({numberOfChannels: 1})')".
-FAIL X buffer0 = new AudioBuffer({length: 21, sampleRate: 48000} incorrectly threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer({length: 21, sampleRate: context.sampleRate})')". assert_true: expected true got false
+PASS buffer = new AudioBuffer({}) threw TypeError: "Member AudioBufferOptions.length is required and must be an instance of unsigned long".
+PASS buffer = new AudioBuffer({length: 1}) threw TypeError: "Member AudioBufferOptions.sampleRate is required and must be an instance of float".
+PASS buffer = new AudioBuffer({sampleRate: 48000}) threw TypeError: "Member AudioBufferOptions.length is required and must be an instance of unsigned long".
+PASS buffer = new AudioBuffer({numberOfChannels: 1} threw TypeError: "Member AudioBufferOptions.length is required and must be an instance of unsigned long".
+PASS buffer0 = new AudioBuffer({length: 21, sampleRate: 48000} did not throw an exception.
+PASS buffer0.numberOfChannels is equal to 1.
+PASS buffer0.length is equal to 21.
+PASS buffer0.sampleRate is equal to 48000.
+PASS buffer1 = new AudioBuffer({numberOfChannels: 3, length: 1, sampleRate: 48000}) did not throw an exception.
+PASS buffer1.numberOfChannels is equal to 3.
+PASS buffer1.length is equal to 1.
+PASS buffer1.sampleRate is equal to 48000.
+PASS < [required options] All assertions passed. (total 12 assertions)
PASS > [invalid option values]
-FAIL X new AudioBuffer({"numberOfChannels":0,"length":1,"sampleRate":16000}) threw "TypeError" instead of NotSupportedError. assert_true: expected true got false
-FAIL X new AudioBuffer({"numberOfChannels":99,"length":0,"sampleRate":16000}) threw "TypeError" instead of NotSupportedError. assert_true: expected true got false
-FAIL X new AudioBuffer({"numberOfChannels":1,"length":0,"sampleRate":16000}) threw "TypeError" instead of NotSupportedError. assert_true: expected true got false
-FAIL X new AudioBuffer({"numberOfChannels":1,"length":1,"sampleRate":100}) threw "TypeError" instead of NotSupportedError. assert_true: expected true got false
-FAIL < [invalid option values] 4 out of 4 assertions were failed. assert_true: expected true got false
+PASS new AudioBuffer({"numberOfChannels":0,"length":1,"sampleRate":16000}) threw NotSupportedError: "Sample rate is not in the supported range.".
+PASS new AudioBuffer({"numberOfChannels":99,"length":0,"sampleRate":16000}) threw NotSupportedError: "Number of channels cannot be more than max supported.".
+PASS new AudioBuffer({"numberOfChannels":1,"length":0,"sampleRate":16000}) threw NotSupportedError: "Length must be at least 1.".
+PASS new AudioBuffer({"numberOfChannels":1,"length":1,"sampleRate":100}) threw NotSupportedError: "Sample rate is not in the supported range.".
+PASS < [invalid option values] All assertions passed. (total 4 assertions)
PASS > [default constructor]
-FAIL X buffer = new AudioBuffer({"numberOfChannels":5,"length":17,"sampleRate":16000}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer(options)')". assert_true: expected true got false
+FAIL X buffer = new AudioBuffer({"numberOfChannels":5,"length":17,"sampleRate":16000}) incorrectly threw NotSupportedError: "Sample rate is not in the supported range.". assert_true: expected true got false
PASS > [valid constructor]
-FAIL X new AudioBuffer({"numberOfChannels":3,"length":42,"sampleRate":54321}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer(options)')". assert_true: expected true got false
+PASS new AudioBuffer({"numberOfChannels":3,"length":42,"sampleRate":54321}) did not throw an exception.
+PASS buffer.numberOfChannels is equal to 3.
+PASS buffer.length is equal to 42.
+PASS buffer.sampleRate is equal to 54321.
+PASS buffer.getChannelData(0) did not throw an exception.
+PASS buffer.getChannelData(0) length is equal to 42.
+PASS buffer.getChannelData(1) did not throw an exception.
+PASS buffer.getChannelData(1) length is equal to 42.
+PASS buffer.getChannelData(2) did not throw an exception.
+PASS buffer.getChannelData(2) length is equal to 42.
+PASS buffer.getChannelData(3) threw IndexSizeError: "Index must be less than number of channels.".
+PASS < [valid constructor] All assertions passed. (total 11 assertions)
PASS > [multiple contexts]
-FAIL # AUDIT TASK RUNNER FINISHED: 4 out of 7 tasks were failed. assert_true: expected true got false
+FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 7 tasks were failed. assert_true: expected true got false
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,9 +1,24 @@
PASS # AUDIT TASK RUNNER STARTED.
-FAIL Executing "validate .buffer" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: 128, sampleRate: context.sampleRate})')"
+PASS Executing "validate .buffer"
PASS Audit report
PASS > [validate .buffer] Validatation of AudioBuffer in .buffer attribute setter
PASS source.buffer = 57 threw TypeError: "The AudioBufferSourceNode.buffer attribute must be an instance of AudioBuffer".
PASS source.buffer = null did not throw an exception.
-PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully.
+PASS source.buffer = buffer did not throw an exception.
+FAIL X source.buffer = new buffer did not throw an exception. assert_true: expected true got false
+PASS source.buffer = null again did not throw an exception.
+FAIL X source.buffer = buffer again did not throw an exception. assert_true: expected true got false
+PASS source.buffer = null after setting to null did not throw an exception.
+PASS Setting source with mono buffer did not throw an exception.
+PASS Setting source with stereo buffer did not throw an exception.
+PASS Setting source with 3 channels buffer did not throw an exception.
+PASS Setting source with 4 channels buffer did not throw an exception.
+PASS Setting source with 5 channels buffer did not throw an exception.
+PASS Setting source with 6 channels buffer did not throw an exception.
+PASS Setting source with 7 channels buffer did not throw an exception.
+PASS Setting source with 8 channels buffer did not throw an exception.
+PASS Setting source with 9 channels buffer did not throw an exception.
+FAIL < [validate .buffer] 2 out of 16 assertions were failed. assert_true: expected true got false
+FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed. assert_true: expected true got false
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,8 +1,7 @@
PASS # AUDIT TASK RUNNER STARTED.
FAIL Executing "initialize" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.audioWorklet.addModule')"
-FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({numberOfChannels: 2, length: 150,
- sampleRate: context.sampleRate})')"
+FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new ConvolverNode(context, {buffer: response})')"
PASS Audit report
PASS > [initialize]
PASS > [test]
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-1-chan-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -13,8 +13,7 @@
FAIL Executing "mono-upmix-clamped-max" promise_test: Unhandled rejection with value: object "SyntaxError: The string did not match the expected pattern."
PASS Audit report
PASS > [initialize] Convolver response with one channel
-FAIL X new AudioBuffer({numberOfChannels: 1, length: 2, sampleRate: 8192}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer(
- {numberOfChannels: 1, length: 2, sampleRate: sampleRate})')". assert_true: expected true got false
+FAIL X new AudioBuffer({numberOfChannels: 1, length: 2, sampleRate: 8192}) incorrectly threw NotSupportedError: "Sample rate is not in the supported range.". assert_true: expected true got false
FAIL < [initialize] 1 out of 1 assertions were failed. assert_true: expected true got false
PASS > [1-channel input] produces 1-channel output
PASS > [2-channel input] produces 2-channel output
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-2-chan-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -12,8 +12,7 @@
FAIL Executing "5.1-channel input explicit mode" promise_test: Unhandled rejection with value: object "SyntaxError: The string did not match the expected pattern."
PASS Audit report
PASS > [initialize] Convolver response with one channel
-FAIL X new AudioBuffer({numberOfChannels: 2, length: 4, sampleRate: 8192}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer(
- {numberOfChannels: 2, length: 4, sampleRate: sampleRate})')". assert_true: expected true got false
+FAIL X new AudioBuffer({numberOfChannels: 2, length: 4, sampleRate: 8192}) incorrectly threw NotSupportedError: "Sample rate is not in the supported range.". assert_true: expected true got false
FAIL < [initialize] 1 out of 1 assertions were failed. assert_true: expected true got false
PASS > [1-channel input] produces 2-channel output
PASS > [2-channel input] produces 2-channel output
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-response-4-chan-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -12,8 +12,7 @@
FAIL Executing "count 1, 5.1-channel in" promise_test: Unhandled rejection with value: object "SyntaxError: The string did not match the expected pattern."
PASS Audit report
PASS > [initialize] Convolver response with one channel
-FAIL X new AudioBuffer({numberOfChannels: 2, length: 4, sampleRate: 8192}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new AudioBuffer(
- {numberOfChannels: 4, length: 8, sampleRate: sampleRate})')". assert_true: expected true got false
+FAIL X new AudioBuffer({numberOfChannels: 2, length: 4, sampleRate: 8192}) incorrectly threw NotSupportedError: "Sample rate is not in the supported range.". assert_true: expected true got false
FAIL < [initialize] 1 out of 1 assertions were failed. assert_true: expected true got false
PASS > [1-channel input] produces 2-channel output
PASS > [2-channel input] produces 2-channel output
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/convolver-setBuffer-already-has-value-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,8 +1,14 @@
PASS # AUDIT TASK RUNNER STARTED.
-FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer(
- {numberOfChannels: 1, length: 1, sampleRate: context.sampleRate})')"
+PASS Executing "test"
PASS Audit report
PASS > [test]
+PASS Set buffer to null before set non-null did not throw an exception.
+PASS Set buffer first normally did not throw an exception.
+PASS Set buffer a second time did not throw an exception.
+PASS Set buffer to null did not throw an exception.
+PASS Set buffer to null again, to make sure did not throw an exception.
+PASS Set buffer to non-null to verify it is set did not throw an exception.
+PASS < [test] All assertions passed. (total 6 assertions)
PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt (265209 => 265210)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,17 +1,42 @@
PASS # AUDIT TASK RUNNER STARTED.
-FAIL Executing "Test 0" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: nsamples, sampleRate: context.sampleRate})')"
-FAIL Executing "Test 1" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: nsamples, sampleRate: context.sampleRate})')"
-FAIL Executing "Test 2" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: nsamples, sampleRate: context.sampleRate})')"
-FAIL Executing "Test 3" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: nsamples, sampleRate: context.sampleRate})')"
-FAIL Executing "Test 4" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: nsamples, sampleRate: context.sampleRate})')"
-FAIL Executing "Test 5" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({length: nsamples, sampleRate: context.sampleRate})')"
+PASS Executing "Test 0"
+PASS Executing "Test 1"
+PASS Executing "Test 2"
+PASS Executing "Test 3"
+PASS Executing "Test 4"
+PASS Executing "Test 5"
PASS Audit report
PASS > [Test 0] Sine wave: 100 Hz
+PASS Sine: 100 Hz equals [0,0.014247103594243526,0.028491314500570297,0.04272974282503128,0.056959498673677444,0.07117769122123718,0.08538143336772919,0.09956784546375275,0.11373404413461685,0.1278771609067917,0.14199431240558624,0.1560826450586319,0.17013929784297943,0.18416140973567963,0.19814614951610565,0.2120906561613083...] with an element-wise tolerance of {"absoluteThreshold":0.0000018045,"relativeThreshold":0}.
+PASS Sine: SNR (db) is greater than or equal to 118.91.
+PASS < [Test 0] All assertions passed. (total 2 assertions)
PASS > [Test 1] Sine wave: -100 Hz
+PASS Sine: -100 Hz equals [0,-0.014247103594243526,-0.028491314500570297,-0.04272974282503128,-0.056959498673677444,-0.07117769122123718,-0.08538143336772919,-0.09956784546375275,-0.11373404413461685,-0.1278771609067917,-0.14199431240558624,-0.1560826450586319,-0.17013929784297943,-0.18416140973567963,-0.19814614951610565,-0.2120906561613083...] with an element-wise tolerance of {"absoluteThreshold":4.7684e-7,"relativeThreshold":0}.
+PASS Sine: SNR (db) is greater than or equal to 130.95.
+PASS < [Test 1] All assertions passed. (total 2 assertions)
PASS > [Test 2] Sine wave: 2 Hz
+PASS Sine: 2 Hz equals [0,0.0002849517040885985,0.000569903408177197,0.0008548550540581346,0.0011398065835237503,0.001424758112989366,0.0017097094096243382,0.0019946605898439884,0.0022796117700636387,0.0025645627174526453,0.0028495131991803646,0.003134463680908084,0.0034194139298051596,0.003704363713040948,0.003989313263446093,0.004274262581020594...] with an element-wise tolerance of {"absoluteThreshold":1.4516e-7,"relativeThreshold":0}.
+PASS Sine: SNR (db) is greater than or equal to 119.93.
+PASS < [Test 2] All assertions passed. (total 2 assertions)
PASS > [Test 3] Sine wave: 1 Hz
+PASS Sine: 1 Hz equals [0,0.00014247585204429924,0.0002849517040885985,0.00042742755613289773,0.000569903408177197,0.0007123792311176658,0.0008548550540581346,0.0009973308769986033,0.0011398065835237503,0.001282282406464219,0.001424758112989366,0.001567233819514513,0.0017097094096243382,0.0018521851161494851,0.0019946605898439884,0.0021371361799538136...] with an element-wise tolerance of {"absoluteThreshold":1.4157e-7,"relativeThreshold":0}.
+PASS Sine: SNR (db) is greater than or equal to 112.22.
+PASS < [Test 3] All assertions passed. (total 2 assertions)
PASS > [Test 4] Custom wave: 100 Hz
+PASS Custom: 100 Hz equals [1,1.0141456127166748,1.0280853509902954,1.0418163537979126,1.0553359985351562,1.0686413049697876,1.081729769706726,1.094598650932312,1.1072453260421753,1.1196671724319458,1.1318618059158325,1.1438266038894653,1.1555593013763428,1.1670573949813843,1.1783186197280884,1.189340591430664...] with an element-wise tolerance of {"absoluteThreshold":0.0000018478,"relativeThreshold":0}.
+PASS Custom: SNR (db) is greater than or equal to 122.43.
+PASS < [Test 4] All assertions passed. (total 2 assertions)
PASS > [Test 5] Custom wave: 1 Hz
-PASS # AUDIT TASK RUNNER FINISHED: 6 tasks ran successfully.
+FAIL X Custom: 1 Hz does not equal [1,1.0001424551010132,1.0002849102020264,1.0004273653030396,1.0005697011947632,1.0007121562957764,1.0008544921875,1.0009968280792236,1.0011391639709473,1.001281499862671,1.001423716545105,1.0015660524368286,1.0017082691192627,1.0018504858016968,1.0019927024841309,1.0021347999572754...] with an element-wise tolerance of {"absoluteThreshold":4.7684e-7,"relativeThreshold":0}.
+ Index Actual Expected AbsError RelError Test threshold
+ [246] 1.0344271659851074e+0 1.0344277620315552e+0 5.9604644775390625e-7 5.7620886603362823e-7 4.7683999999999997e-7
+ [250] 1.0349766016006470e+0 1.0349771976470947e+0 5.9604644775390625e-7 5.7590297555245792e-7 4.7683999999999997e-7
+ [252] 1.0352511405944824e+0 1.0352517366409302e+0 5.9604644775390625e-7 5.7575025151649741e-7 4.7683999999999997e-7
+ Max AbsError of 5.9604644775390625e-7 at index of 246.
+ Max RelError of 5.7620886603362823e-7 at index of 246.
+ assert_true: expected true got false
+FAIL X Custom: SNR (db) is not greater than or equal to 138.76. Got 131.46607450774167. assert_true: expected true got false
+FAIL < [Test 5] 2 out of 2 assertions were failed. assert_true: expected true got false
+FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 6 tasks were failed. assert_true: expected true got false
Modified: trunk/LayoutTests/webaudio/audiobuffer-crash-expected.txt (265209 => 265210)
--- trunk/LayoutTests/webaudio/audiobuffer-crash-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/webaudio/audiobuffer-crash-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -3,7 +3,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS context = new webkitAudioContext().createBuffer(1, -1, 44100) threw exception NotSupportedError: The operation is not supported..
+PASS context = new webkitAudioContext().createBuffer(1, -1, 44100) threw exception NotSupportedError: Channel was not able to be created..
PASS Test passed because if it didn't crash.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/webaudio/audiobuffersource-channels-expected.txt (265209 => 265210)
--- trunk/LayoutTests/webaudio/audiobuffersource-channels-expected.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/LayoutTests/webaudio/audiobuffersource-channels-expected.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -13,7 +13,7 @@
PASS 7 channels buffer can be set.
PASS 8 channels buffer can be set.
PASS 9 channels buffer can be set.
-PASS context.createBuffer(64, 1024, context.sampleRate) threw exception NotSupportedError: The operation is not supported..
+PASS context.createBuffer(64, 1024, context.sampleRate) threw exception NotSupportedError: Number of channels cannot be more than max supported..
PASS source.buffer is not null
PASS source.buffer = null did not throw exception.
PASS source.buffer is null
Modified: trunk/Source/WebCore/CMakeLists.txt (265209 => 265210)
--- trunk/Source/WebCore/CMakeLists.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -449,6 +449,7 @@
Modules/webaudio/AnalyserOptions.idl
Modules/webaudio/AudioBuffer.idl
Modules/webaudio/AudioBufferCallback.idl
+ Modules/webaudio/AudioBufferOptions.idl
Modules/webaudio/AudioBufferSourceNode.idl
Modules/webaudio/AudioContext.idl
Modules/webaudio/AudioContextLatencyCategory.idl
Modified: trunk/Source/WebCore/ChangeLog (265209 => 265210)
--- trunk/Source/WebCore/ChangeLog 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/ChangeLog 2020-08-03 19:22:58 UTC (rev 265210)
@@ -1,3 +1,32 @@
+2020-08-03 Clark Wang <clark_w...@apple.com>
+
+ Added AudioBuffer Constructor
+ https://bugs.webkit.org/show_bug.cgi?id=214990
+
+ Reviewed by Chris Dumez.
+
+ Added AudioBuffer constructor according to spec: https://www.w3.org/TR/webaudio/#AudioBuffer-constructors.
+ Added in AudioBufferOptions files. Updated BaseAudioContext::createBuffer to use new constructor.
+
+ Re-baselined existing tests. Some fail now due to unsupported sampleRate.
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Modules/webaudio/AudioBuffer.cpp:
+ (WebCore::AudioBuffer::create):
+ (WebCore::AudioBuffer::AudioBuffer):
+ * Modules/webaudio/AudioBuffer.h:
+ * Modules/webaudio/AudioBuffer.idl:
+ * Modules/webaudio/AudioBufferOptions.h: Added.
+ * Modules/webaudio/AudioBufferOptions.idl: Added.
+ * Modules/webaudio/BaseAudioContext.cpp:
+ (WebCore::BaseAudioContext::createBuffer):
+ * Modules/webaudio/BaseAudioContext.h:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+
2020-08-03 Kenneth Russell <k...@chromium.org>
[WebGL2] webgl/2.0.0/conformance[2]/textures/image_bitmap* failures
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (265209 => 265210)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-03 19:22:58 UTC (rev 265210)
@@ -298,6 +298,7 @@
$(PROJECT_DIR)/Modules/webaudio/AnalyserOptions.idl
$(PROJECT_DIR)/Modules/webaudio/AudioBuffer.idl
$(PROJECT_DIR)/Modules/webaudio/AudioBufferCallback.idl
+$(PROJECT_DIR)/Modules/webaudio/AudioBufferOptions.idl
$(PROJECT_DIR)/Modules/webaudio/AudioBufferSourceNode.idl
$(PROJECT_DIR)/Modules/webaudio/AudioContext.idl
$(PROJECT_DIR)/Modules/webaudio/AudioContextLatencyCategory.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (265209 => 265210)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-03 19:22:58 UTC (rev 265210)
@@ -151,6 +151,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioBuffer.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioBufferCallback.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioBufferCallback.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioBufferOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioBufferOptions.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioBufferSourceNode.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioBufferSourceNode.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSAudioConfiguration.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (265209 => 265210)
--- trunk/Source/WebCore/DerivedSources.make 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/DerivedSources.make 2020-08-03 19:22:58 UTC (rev 265210)
@@ -381,6 +381,7 @@
$(WebCore)/Modules/webaudio/AnalyserOptions.idl \
$(WebCore)/Modules/webaudio/AudioBuffer.idl \
$(WebCore)/Modules/webaudio/AudioBufferCallback.idl \
+ $(WebCore)/Modules/webaudio/AudioBufferOptions.idl \
$(WebCore)/Modules/webaudio/AudioBufferSourceNode.idl \
$(WebCore)/Modules/webaudio/AudioContext.idl \
$(WebCore)/Modules/webaudio/AudioContextLatencyCategory.idl \
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp (265209 => 265210)
--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp 2020-08-03 19:22:58 UTC (rev 265210)
@@ -52,6 +52,24 @@
return buffer;
}
+ExceptionOr<Ref<AudioBuffer>> AudioBuffer::create(const AudioBufferOptions& options)
+{
+ if (options.numberOfChannels > AudioContext::maxNumberOfChannels())
+ return Exception { NotSupportedError, "Number of channels cannot be more than max supported."_s };
+
+ if (!options.length)
+ return Exception { NotSupportedError, "Length must be at least 1."_s };
+
+ if (options.sampleRate < 22050 || options.sampleRate > 96000)
+ return Exception { NotSupportedError, "Sample rate is not in the supported range."_s };
+
+ auto buffer = adoptRef(*new AudioBuffer(options.numberOfChannels, options.length, options.sampleRate));
+ if (!buffer->length())
+ return Exception { NotSupportedError, "Channel was not able to be created."_s };
+
+ return buffer;
+}
+
RefPtr<AudioBuffer> AudioBuffer::createFromAudioFileData(const void* data, size_t dataSize, bool mixToMono, float sampleRate)
{
RefPtr<AudioBus> bus = createBusFromInMemoryAudioFile(data, dataSize, mixToMono, sampleRate);
@@ -60,9 +78,9 @@
return adoptRef(*new AudioBuffer(*bus));
}
-AudioBuffer::AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
+AudioBuffer::AudioBuffer(unsigned numberOfChannels, size_t length, float sampleRate)
: m_sampleRate(sampleRate)
- , m_length(numberOfFrames)
+ , m_length(length)
{
m_channels.reserveCapacity(numberOfChannels);
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h (265209 => 265210)
--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.h 2020-08-03 19:22:58 UTC (rev 265210)
@@ -29,6 +29,7 @@
#pragma once
+#include "AudioBufferOptions.h"
#include "ExceptionOr.h"
#include <_javascript_Core/Float32Array.h>
#include <wtf/Lock.h>
@@ -41,7 +42,7 @@
class AudioBuffer : public RefCounted<AudioBuffer> {
public:
static RefPtr<AudioBuffer> create(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
-
+ static ExceptionOr<Ref<AudioBuffer>> create(const AudioBufferOptions&);
// Returns nullptr if data is not a valid audio file.
static RefPtr<AudioBuffer> createFromAudioFileData(const void* data, size_t dataSize, bool mixToMono, float sampleRate);
@@ -70,7 +71,7 @@
size_t memoryCost() const;
private:
- AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
+ AudioBuffer(unsigned numberOfChannels, size_t length, float sampleRate);
explicit AudioBuffer(AudioBus&);
void invalidate();
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl (265209 => 265210)
--- trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBuffer.idl 2020-08-03 19:22:58 UTC (rev 265210)
@@ -32,7 +32,8 @@
JSGenerateToJSObject,
ReportExtraMemoryCost,
] interface AudioBuffer {
- readonly attribute long length; // in sample-frames
+ [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor(AudioBufferOptions options);
+ readonly attribute unsigned long length; // in sample-frames
readonly attribute unrestricted float duration; // in seconds
readonly attribute unrestricted float sampleRate; // in sample-frames per second
Added: trunk/Source/WebCore/Modules/webaudio/AudioBufferOptions.h (0 => 265210)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferOptions.h (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferOptions.h 2020-08-03 19:22:58 UTC (rev 265210)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUDIO)
+
+namespace WebCore {
+
+struct AudioBufferOptions {
+ unsigned numberOfChannels { 1 };
+ unsigned length { 1 };
+ float sampleRate { 44100 };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)
Added: trunk/Source/WebCore/Modules/webaudio/AudioBufferOptions.idl (0 => 265210)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferOptions.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferOptions.idl 2020-08-03 19:22:58 UTC (rev 265210)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=WEB_AUDIO,
+] dictionary AudioBufferOptions {
+ unsigned long numberOfChannels = 1;
+ required unsigned long length;
+ required float sampleRate;
+};
Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (265209 => 265210)
--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-08-03 19:22:58 UTC (rev 265210)
@@ -33,6 +33,7 @@
#include "AsyncAudioDecoder.h"
#include "AudioBuffer.h"
#include "AudioBufferCallback.h"
+#include "AudioBufferOptions.h"
#include "AudioBufferSourceNode.h"
#include "AudioListener.h"
#include "AudioNodeInput.h"
@@ -385,12 +386,9 @@
return false;
}
-ExceptionOr<Ref<AudioBuffer>> BaseAudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate)
+ExceptionOr<Ref<AudioBuffer>> BaseAudioContext::createBuffer(unsigned numberOfChannels, unsigned length, float sampleRate)
{
- auto audioBuffer = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate);
- if (!audioBuffer)
- return Exception { NotSupportedError };
- return audioBuffer.releaseNonNull();
+ return AudioBuffer::create(AudioBufferOptions {numberOfChannels, length, sampleRate});
}
ExceptionOr<Ref<AudioBuffer>> BaseAudioContext::createBuffer(ArrayBuffer& arrayBuffer, bool mixToMono)
Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.h (265209 => 265210)
--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.h 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.h 2020-08-03 19:22:58 UTC (rev 265210)
@@ -122,7 +122,7 @@
void incrementActiveSourceCount();
void decrementActiveSourceCount();
- ExceptionOr<Ref<AudioBuffer>> createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate);
+ ExceptionOr<Ref<AudioBuffer>> createBuffer(unsigned numberOfChannels, unsigned length, float sampleRate);
ExceptionOr<Ref<AudioBuffer>> createBuffer(ArrayBuffer&, bool mixToMono);
// Asynchronous audio file data decoding.
Modified: trunk/Source/WebCore/Sources.txt (265209 => 265210)
--- trunk/Source/WebCore/Sources.txt 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/Sources.txt 2020-08-03 19:22:58 UTC (rev 265210)
@@ -2631,6 +2631,7 @@
JSAttr.cpp
JSAudioBuffer.cpp
JSAudioBufferCallback.cpp
+JSAudioBufferOptions.cpp
JSAudioBufferSourceNode.cpp
JSAudioConfiguration.cpp
JSAudioContext.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265209 => 265210)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-03 18:31:59 UTC (rev 265209)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-03 19:22:58 UTC (rev 265210)
@@ -15899,6 +15899,8 @@
E7E0352524CF715E008DFEFB /* ChannelSplitterOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChannelSplitterOptions.idl; sourceTree = "<group>"; };
E7E0356F24D4E190008DFEFB /* AnalyserOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AnalyserOptions.idl; sourceTree = "<group>"; };
E7E0357124D4E191008DFEFB /* AnalyserOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnalyserOptions.h; sourceTree = "<group>"; };
+ E7E0355724D346DF008DFEFB /* AudioBufferOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioBufferOptions.h; sourceTree = "<group>"; };
+ E7E0355924D346DF008DFEFB /* AudioBufferOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AudioBufferOptions.idl; sourceTree = "<group>"; };
EB081CD81696084400553730 /* TypeConversions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeConversions.h; sourceTree = "<group>"; };
EB081CD91696084400553730 /* TypeConversions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = TypeConversions.idl; sourceTree = "<group>"; };
EBE5B224245A26EE003A5A88 /* SQLiteStatementAutoResetScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteStatementAutoResetScope.h; sourceTree = "<group>"; };
@@ -29488,6 +29490,8 @@
FD315FB012B0267500C1A359 /* AudioBuffer.idl */,
FD5686CB13AC181400B69C68 /* AudioBufferCallback.h */,
FD5686CD13AC183E00B69C68 /* AudioBufferCallback.idl */,
+ E7E0355724D346DF008DFEFB /* AudioBufferOptions.h */,
+ E7E0355924D346DF008DFEFB /* AudioBufferOptions.idl */,
FD315FB112B0267500C1A359 /* AudioBufferSourceNode.cpp */,
FD315FB212B0267500C1A359 /* AudioBufferSourceNode.h */,
FD315FB312B0267500C1A359 /* AudioBufferSourceNode.idl */,