[Webkit-unassigned] [Bug 243719] New: Memory allocation performed on the audio thread.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 9 00:13:14 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=243719

            Bug ID: 243719
           Summary: Memory allocation performed on the audio thread.
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Keywords: Regression
          Severity: Normal
          Priority: P2
         Component: WebRTC
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jean-yves.avenard at apple.com
                CC: youennf at gmail.com
        Depends on: 240632

In bug 240632, logging was added.

This is done via calls like:
https://searchfox.org/wubkat/rev/062294f6788fc6ce5688e47ffe1c23955cacbff1/Source/WebCore/platform/audio/cocoa/AudioSampleDataConverter.mm#91-93
```
                callOnMainThread([] {
                    RELEASE_LOG(WebRTC, "AudioSampleDataConverter::updateBufferedAmount low buffer");
                });
```

The lambda's Function will be allocated on the heap and passed to callOnMainThread, causing an assertion:
    ASSERT(!forbidMallocUseScopeCount || disableMallocRestrictionScopeCount);
https://searchfox.org/wubkat/rev/062294f6788fc6ce5688e47ffe1c23955cacbff1/Source/WTF/wtf/FastMalloc.cpp#524

backtrace:
error: invalid value path 'target.prefer-gdb-objc-realized-classes'
(lldb) bt 
* thread #78, queue = 'WebKitWebRTCAudioModule', stop reason = EXC_BAD_ACCESS (code=1, address=0xbbadbeef)
    frame #0: 0x00000003ab2c1aee JavaScriptCore`::WTFCrash() at Assertions.cpp:328:35
    frame #1: 0x00000003ace45d5b JavaScriptCore`WTFCrashWithInfo((null)=524, (null)="/Users/jyavenard/Work/webkit/OpenSource/Source/WTF/wtf/FastMalloc.cpp", (null)="void *WTF::fastMalloc(size_t)", (null)=11) at Assertions.h:754:5
    frame #2: 0x00000003ab307242 JavaScriptCore`WTF::fastMalloc(size=<unavailable>) at FastMalloc.cpp:524:5 [opt]
    frame #3: 0x00000003c89c21d5 WebCore`WTF::Detail::CallableWrapperBase<void>::operator new(size=16) at Function.h:38:5
    frame #4: 0x00000003ca42e465 WebCore`std::__1::__unique_if<WTF::Detail::CallableWrapper<WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0, void> >::__unique_single std::__1::make_unique<WTF::Detail::CallableWrapper<WebCore::AudioSampleDataConverter::updateBufferedAmount(__args=0x0000700007748710)::$_0, void>, WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0>(WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0&&) at unique_ptr.h:728:28
    frame #5: 0x00000003ca42e3d0 WebCore`decltype(args=0x0000700007748710) WTF::makeUnique<WTF::Detail::CallableWrapper<WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0, void>, WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0>(WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0&&) at StdLibExtras.h:544:12
    frame #6: 0x00000003ca42e37d WebCore`WTF::Function<void ()>::Function<WebCore::AudioSampleDataConverter::updateBufferedAmount(this=0x0000700007748718, callable=0x0000700007748710)::$_0, void>(WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0&&) at Function.h:73:29
    frame #7: 0x00000003ca41e3fd WebCore`WTF::Function<void ()>::Function<WebCore::AudioSampleDataConverter::updateBufferedAmount(this=0x0000700007748718, callable=0x0000700007748710)::$_0, void>(WebCore::AudioSampleDataConverter::updateBufferedAmount(unsigned long, unsigned long)::$_0&&) at Function.h:73:130
  * frame #8: 0x00000003ca41e1b1 WebCore`WebCore::AudioSampleDataConverter::updateBufferedAmount(this=0x0000000383cc52e0, currentBufferedAmount=416, pushedSampleSize=480) at AudioSampleDataConverter.mm:91:34
    frame #9: 0x00000003ca41f307 WebCore`WebCore::AudioSampleDataSource::pushSamplesInternal(this=0x0000000383cc51e0, bufferList=0x00006000032d21c0, presentationTime=0x00007000077488d8, sampleCount=480) at AudioSampleDataSource.mm:132:21
    frame #10: 0x00000003ca41fd21 WebCore`WebCore::AudioSampleDataSource::pushSamples(this=0x0000000383cc51e0, sampleTime=0x00007000077488d8, audioData=0x0000000504080950, sampleCount=480) at AudioSampleDataSource.mm:191:5
    frame #11: 0x00000003caf88074 WebCore`WebCore::WebAudioSourceProviderCocoa::receivedNewAudioSamples(this=0x00000003f4b7ba10, data=0x0000000504080950, description=0x00000003eb3c69c0, frameCount=480) at WebAudioSourceProviderCocoa.mm:150:19
    frame #12: 0x00000003cd3803ab WebCore`WebCore::MediaStreamTrackAudioSourceProviderCocoa::audioSamplesAvailable(this=0x00000003f4b7ba10, (null)=0x0000700007748a38, data=0x0000000504080950, description=0x00000003eb3c69c0, frameCount=480) at MediaStreamTrackAudioSourceProviderCocoa.cpp:86:5
    frame #13: 0x00000003cd2f8946 WebCore`WebCore::RealtimeMediaSource::audioSamplesAvailable(this=0x00000003eb3c6800, time=0x0000700007748a38, audioData=0x0000000504080950, description=0x00000003eb3c69c0, numberOfFrames=480) at RealtimeMediaSource.cpp:224:19
    frame #14: 0x00000003cd380e05 WebCore`WebCore::RealtimeIncomingAudioSourceCocoa::OnData(this=0x00000003eb3c6800, audioData=0x00007f907d846260, bitsPerSample=16, sampleRate=48000, numberOfChannels=1, numberOfFrames=480) at RealtimeIncomingAudioSourceCocoa.cpp:145:5
    frame #15: 0x00000003cd302ec9 WebCore`webrtc::AudioTrackSinkInterface::OnData(this=0x00000003eb3c6800, audio_data=0x00007f907d846260, bits_per_sample=16, sample_rate=48000, number_of_channels=1, number_of_frames=480, absolute_capture_timestamp_ms= Has Value=false ) at media_stream_interface.h:215:12
    frame #16: 0x0000000387ec85fa libwebrtc.dylib`webrtc::RemoteAudioSource::OnData(this=0x000060000091c1a0, audio=0x0000700007748d68) at remote_audio_source.cc:161:11
    frame #17: 0x0000000387ec9859 libwebrtc.dylib`webrtc::RemoteAudioSource::AudioDataProxy::OnData(this=0x000060000303c970, audio=0x0000700007748d68) at remote_audio_source.cc:45:14
    frame #18: 0x00000003877d27a7 libwebrtc.dylib`webrtc::voe::(anonymous namespace)::ChannelReceive::GetAudioFrameWithInfo(this=0x00007f907b03e600, sample_rate_hz=48000, audio_frame=0x00007f907d846210) at channel_receive.cc:417:20
    frame #19: 0x000000038760cdca libwebrtc.dylib`webrtc::internal::AudioReceiveStream::GetAudioFrameWithInfo(this=0x00007f907af0d0e0, sample_rate_hz=48000, audio_frame=0x00007f907d846210) at audio_receive_stream.cc:393:25
    frame #20: 0x00000003875cfafb libwebrtc.dylib`webrtc::AudioMixerImpl::GetAudioFromSources(this=0x00007f907d82d600, output_frequency=48000) at audio_mixer_impl.cc:205:42
    frame #21: 0x00000003875cf856 libwebrtc.dylib`webrtc::AudioMixerImpl::Mix(this=0x00007f907d82d600, number_of_channels=2, audio_frame_for_mixing=0x00007f907d832a30) at audio_mixer_impl.cc:175:27
    frame #22: 0x0000000387648a9b libwebrtc.dylib`webrtc::AudioTransportImpl::PullRenderData(this=0x00007f907d832910, bits_per_sample=16, sample_rate=48000, number_of_channels=2, number_of_frames=480, audio_data=0x0000700007749ec0, elapsed_time_ms=0x0000700007749ea8, ntp_time_ms=0x0000700007749ea0) at audio_transport_impl.cc:250:11
    frame #23: 0x00000003c8ce155f WebCore`WebCore::LibWebRTCAudioModule::pollFromSource(this=0x00000003f49b9980) at LibWebRTCAudioModule.cpp:146:27
    frame #24: 0x00000003c8ce1400 WebCore`WebCore::LibWebRTCAudioModule::pollAudioData(this=0x00000003f49b9980) at LibWebRTCAudioModule.cpp:132:9
    frame #25: 0x00000003c8ce5a58 WebCore`WebCore::LibWebRTCAudioModule::pollAudioData(this=0x00000005042104e8)::$_5::operator()() const at LibWebRTCAudioModule.cpp:125:9
    frame #26: 0x00000003c8ce5999 WebCore`WTF::Detail::CallableWrapper<WebCore::LibWebRTCAudioModule::pollAudioData()::$_5, void>::call(this=0x00000005042104e0) at Function.h:53:39
    frame #27: 0x00000003ab2ec262 JavaScriptCore`WTF::Function<void ()>::operator(this=0x0000000504180368)() const at Function.h:82:35
    frame #28: 0x00000003ab416829 JavaScriptCore`WTF::(anonymous namespace)::DispatchWorkItem::operator(this=0x0000000504180360)() at WorkQueueCocoa.cpp:40:25
    frame #29: 0x00000003ab4154dd JavaScriptCore`void WTF::dispatchWorkItem<WTF::(anonymous namespace)::DispatchWorkItem>(dispatchContext=0x0000000504180360) at WorkQueueCocoa.cpp:48:5
    frame #30: 0x00000003804591ac libdispatch.dylib`_dispatch_client_callout + 8
    frame #31: 0x000000038045c0e4 libdispatch.dylib`_dispatch_continuation_pop + 612
    frame #32: 0x0000000380473d89 libdispatch.dylib`_dispatch_source_invoke + 2424
    frame #33: 0x0000000380460775 libdispatch.dylib`_dispatch_lane_serial_drain + 352
    frame #34: 0x0000000380461890 libdispatch.dylib`_dispatch_lane_invoke + 442
    frame #35: 0x000000038046fa74 libdispatch.dylib`_dispatch_workloop_worker_thread + 826
    frame #36: 0x0000000380088463 libsystem_pthread.dylib`_pthread_wqthread + 326
    frame #37: 0x000000038008ebe7 libsystem_pthread.dylib`start_wqthread + 15
(lldb)


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=240632
[Bug 240632] Add some logging in AudioSampleDataConverter::updateBufferedAmount
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220809/728c49e4/attachment-0001.htm>


More information about the webkit-unassigned mailing list