Bug 216093 - Don't modify the response when creating a ConvolverNode
Summary: Don't modify the response when creating a ConvolverNode
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 212611
  Show dependency treegraph
 
Reported: 2020-09-02 13:38 PDT by Chris Dumez
Modified: 2020-09-03 06:35 PDT (History)
8 users (show)

See Also:


Attachments
Patch (112.52 KB, patch)
2020-09-02 13:50 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (16.57 KB, patch)
2020-09-02 13:55 PDT, Chris Dumez
eric.carlson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>