Bug 223449 - Avoid heap allocations under AudioSampleDataSource::pullSamplesInternal()
Summary: Avoid heap allocations under AudioSampleDataSource::pullSamplesInternal()
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: 223226
  Show dependency treegraph
 
Reported: 2021-03-18 09:44 PDT by Chris Dumez
Modified: 2021-05-12 07:13 PDT (History)
9 users (show)

See Also:


Attachments
Patch (3.22 KB, patch)
2021-03-18 09:53 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-03-18 09:44:05 PDT
Avoid heap allocations under AudioSampleDataSource::pullSamplesInternal():
Thread 12 Crashed:: WebCore: AudioWorklet
0   com.apple.JavaScriptCore            0x000000059fd88aee 0x59fd86000 + 10990
1   com.apple.JavaScriptCore            0x00000005a152629b 0x59fd86000 + 24773275
2   com.apple.JavaScriptCore            0x000000059fdc637b 0x59fd86000 + 263035
3   com.apple.WebCore                   0x00000005808ffc65 WTF::Detail::CallableWrapperBase<void>::operator new(unsigned long) + 21 (Function.h:37)
4   com.apple.WebCore                   0x0000000582265d18 std::__1::__unique_if<WTF::Detail::CallableWrapper<WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3, void> >::__unique_single std::__1::make_unique<WTF::Detail::CallableWrapper<WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3, void>, WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3>(WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3&&) + 40 (memory:2755)
5   com.apple.WebCore                   0x0000000582265c86 decltype(auto) WTF::makeUnique<WTF::Detail::CallableWrapper<WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3, void>, WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3>(WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3&&) + 54 (StdLibExtras.h:507)
6   com.apple.WebCore                   0x0000000582265c30 WTF::Function<void ()>::Function<WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3, void>(WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3&&) + 48 (Function.h:74)
7   com.apple.WebCore                   0x000000058224e48d WTF::Function<void ()>::Function<WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3, void>(WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode)::$_3&&) + 29 (Function.h:74)
8   com.apple.WebCore                   0x000000058224ddc8 WebCore::AudioSampleDataSource::pullSamplesInternal(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode) + 824 (AudioSampleDataSource.mm:242)
9   com.apple.WebCore                   0x000000058224e8aa WebCore::AudioSampleDataSource::pullSamples(AudioBufferList&, unsigned long, unsigned long long, double, WebCore::AudioSampleDataSource::PullMode) + 170 (AudioSampleDataSource.mm:343)
10  com.apple.WebCore                   0x000000058295c717 WebCore::WebAudioSourceProviderCocoa::provideInput(WebCore::AudioBus*, unsigned long) + 919 (WebAudioSourceProviderCocoa.mm:97)
11  com.apple.WebCore                   0x0000000582c8c0a6 WebCore::MediaElementAudioSourceNode::provideInput(WebCore::AudioBus*, unsigned long) + 166 (MediaElementAudioSourceNode.cpp:125)
12  com.apple.WebCore                   0x0000000582c8c52e WebCore::MediaElementAudioSourceNode::process(unsigned long) + 606 (MediaElementAudioSourceNode.cpp:178)
13  com.apple.WebCore                   0x0000000582bdc9ae WebCore::AudioNode::processIfNecessary(unsigned long) + 462 (AudioNode.cpp:474)
Comment 1 Chris Dumez 2021-03-18 09:53:30 PDT
Created attachment 423610 [details]
Patch
Comment 2 EWS 2021-03-18 11:48:16 PDT
Committed r274657: <https://commits.webkit.org/r274657>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423610 [details].
Comment 3 Radar WebKit Bug Importer 2021-03-18 11:49:35 PDT
<rdar://problem/75583342>
Comment 4 youenn fablet 2021-05-12 07:13:27 PDT
Hum, this logging was useful in the past to debug crackling and was recently useful again.
I think we should try to resurrect it in some ways.