RESOLVED FIXED 216859
Slightly improve AudioBufferSourceNode resampling
https://bugs.webkit.org/show_bug.cgi?id=216859
Summary Slightly improve AudioBufferSourceNode resampling
Chris Dumez
Reported 2020-09-22 16:54:10 PDT
Slightly improve AudioBufferSourceNode resampling. Use simple linear extrapolation to resample the data when we reach the end of the buffer. Previously, the last sample would just be repeated enough times.
Attachments
Patch (15.06 KB, patch)
2020-09-22 16:58 PDT, Chris Dumez
no flags
Patch (16.11 KB, patch)
2020-09-22 17:01 PDT, Chris Dumez
no flags
Patch (15.91 KB, patch)
2020-09-22 17:13 PDT, Chris Dumez
no flags
Patch (16.13 KB, patch)
2020-09-22 17:56 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-09-22 16:58:56 PDT
Chris Dumez
Comment 2 2020-09-22 17:01:44 PDT
Eric Carlson
Comment 3 2020-09-22 17:03:35 PDT
Comment on attachment 409424 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=409424&action=review > Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp:416 > + float sample; > + if (readIndex == readIndex2 && readIndex >= 1) { > + // We're at the end of the buffer, so just linearly extrapolate from the last two samples. > + float sample1 = source[readIndex - 1]; > + float sample2 = source[readIndex]; > + sample = sample2 + (sample2 - sample1) * interpolationFactor; > + } else { > + float sample1 = source[readIndex]; > + float sample2 = source[readIndex2]; > + sample = sample1 + interpolationFactor * (sample2 - sample1); > + } > > - destination[writeIndex] = narrowPrecisionToFloat(sample); > + destination[writeIndex] = sample; It looks like this is an identical copy of the code above. Can it be moved to a shared function?
Chris Dumez
Comment 4 2020-09-22 17:13:26 PDT
Chris Dumez
Comment 5 2020-09-22 17:56:57 PDT
EWS
Comment 6 2020-09-22 18:49:36 PDT
Committed r267453: <https://trac.webkit.org/changeset/267453> All reviewed patches have been landed. Closing bug and clearing flags on attachment 409432 [details].
Radar WebKit Bug Importer
Comment 7 2020-09-22 18:50:21 PDT
Note You need to log in before you can comment on or make changes to this bug.