Bug 216629

Summary: AnalyserNode.getFloatFrequencyData() should fill array with -Infinity when input is silent
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric.carlson, ews-watchlist, ggaren, glenn, jer.noble, philipj, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 212611    
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch none

Description Chris Dumez 2020-09-16 18:05:11 PDT
AnalyserNode.getFloatFrequencyData() should fill array with -Infinity when input is silent.
Comment 1 Chris Dumez 2020-09-16 18:07:02 PDT
Created attachment 408972 [details]
Patch
Comment 2 Chris Dumez 2020-09-16 19:41:21 PDT
Created attachment 408982 [details]
Patch
Comment 3 youenn fablet 2020-09-17 01:09:29 PDT
Comment on attachment 408982 [details]
Patch

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

> Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp:214
>          float* destination = destinationArray.data();

auto

> Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp:218
>              destination[i] = static_cast<float>(dbMag);

linearToDecibels returns a float, so there is probably no need for this double to float cast.
One liner: destination[i] = AudioUtilities::linearToDecibels(source[i]);

> Source/WebCore/platform/audio/AudioUtilities.cpp:45
>  }

Might be worth inlining
Comment 4 Chris Dumez 2020-09-17 08:36:03 PDT
Created attachment 409034 [details]
Patch
Comment 5 Chris Dumez 2020-09-17 09:17:03 PDT
Created attachment 409040 [details]
Patch
Comment 6 EWS 2020-09-17 11:39:29 PDT
Committed r267202: <https://trac.webkit.org/changeset/267202>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409040 [details].
Comment 7 Radar WebKit Bug Importer 2020-09-17 11:40:17 PDT
<rdar://problem/69084553>