RESOLVED FIXED 214926
Added copyFromChannel, copyToChannel to AudioBuffer
https://bugs.webkit.org/show_bug.cgi?id=214926
Summary Added copyFromChannel, copyToChannel to AudioBuffer
Clark Wang
Reported 2020-07-29 11:43:23 PDT
Added copyFromChannel, copyToChannel methods to AudioBuffer according to spec: https://www.w3.org/TR/webaudio/#dom-audiobuffer-copyfromchannel-destination.
Attachments
Patch (21.47 KB, patch)
2020-07-29 11:48 PDT, Clark Wang
no flags
Patch (21.46 KB, patch)
2020-07-29 13:15 PDT, Clark Wang
no flags
Patch (21.43 KB, patch)
2020-07-29 14:12 PDT, Clark Wang
no flags
Clark Wang
Comment 1 2020-07-29 11:48:33 PDT
Darin Adler
Comment 2 2020-07-29 11:51:11 PDT
Comment on attachment 405477 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405477&action=review > Source/WebCore/Modules/webaudio/AudioBuffer.h:57 > + ExceptionOr<void> copyFromChannel(Ref<Float32Array>, size_t channelNumber, size_t bufferOffset); > + ExceptionOr<void> copyToChannel(Ref<Float32Array>, size_t channelNumber, size_t startInChannel); Ref<Float32Array> is not the correct argument type; creates unnecessary reference count churn. Ref<Float32Array>&& is better.
Chris Dumez
Comment 3 2020-07-29 11:59:18 PDT
Comment on attachment 405477 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405477&action=review > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:128 > +ExceptionOr<void> AudioBuffer::copyFromChannel(Ref<Float32Array> destination, size_t channelNumber, size_t bufferOffset) Ref<Float32Array>&&. It may be a good idea to use unsigned type for the other parameters, to match the IDL > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:130 > + if (destination.get().isShared()) destination->isShared() > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:134 > + return Exception { IndexSizeError, "channelNumber is out of index."_s }; "out of index" ? > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:147 > + float* dst = destination.get().data(); destination->data() > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:156 > +ExceptionOr<void> AudioBuffer::copyToChannel(Ref<Float32Array> source, size_t channelNumber, size_t bufferOffset) Ref<Float32Array>&& and unsigned for others. > Source/WebCore/Modules/webaudio/AudioBuffer.cpp:162 > + return Exception { IndexSizeError, "channelNumber is out of index."_s }; "out of index"?
Clark Wang
Comment 4 2020-07-29 13:15:06 PDT
Clark Wang
Comment 5 2020-07-29 14:12:27 PDT
Clark Wang
Comment 6 2020-07-29 14:24:17 PDT
New patch includes a re-baselined test that incorporates new ExceptionError message.
EWS
Comment 7 2020-07-29 15:07:09 PDT
Committed r265062: <https://trac.webkit.org/changeset/265062> All reviewed patches have been landed. Closing bug and clearing flags on attachment 405498 [details].
Radar WebKit Bug Importer
Comment 8 2020-07-29 15:08:20 PDT
Note You need to log in before you can comment on or make changes to this bug.