Bug 216093

Summary: Don't modify the response when creating a ConvolverNode
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, jer.noble, peng.liu6, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=216118
Bug Depends on:    
Bug Blocks: 212611    
Attachments:
Description Flags
Patch
none
Patch eric.carlson: review+

Description Chris Dumez 2020-09-02 13:38:01 PDT
When creating a ConvolverNode with normalization (the default), the ConvolverNode was modifying the supplied AudioBuffer containing the desired impulse response. This happens because the normalization factor was applied to the buffer, convolver stages were computed, and then the normalization was undone.  Due to floating-point roundoff, this can (and does) modify the buffer.
Comment 1 Chris Dumez 2020-09-02 13:50:06 PDT
Created attachment 407798 [details]
Patch
Comment 2 Chris Dumez 2020-09-02 13:55:41 PDT
Created attachment 407801 [details]
Patch
Comment 3 Peng Liu 2020-09-02 14:33:36 PDT
Comment on attachment 407801 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407801&action=review

> Source/WebCore/platform/audio/FFTFrame.cpp:175
> +

Nit. There is an extra blank line here?

> LayoutTests/webaudio/convolvernode-unmodified-buffer.html:33
> +            // response if it hasn't been fixed not to do that.

Nit. The comment sounds strange.

> LayoutTests/webaudio/convolvernode-unmodified-buffer.html:53
> +            // better be unmodified.

Ditto.
Comment 4 Chris Dumez 2020-09-02 15:12:04 PDT
Committed r266492: <https://trac.webkit.org/changeset/266492>
Comment 5 Radar WebKit Bug Importer 2020-09-02 15:13:14 PDT
<rdar://problem/68235985>