Bug 209969

Summary: Remove unnecessary memory allocation from RealtimeIncomingAudioSourceCocoa::OnData
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, hta, jer.noble, philipj, sergio, tommyw, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description youenn fablet 2020-04-03 08:56:05 PDT
Remove unnecessary memory allocation from RealtimeIncomingAudioSourceCocoa::OnData
Comment 1 youenn fablet 2020-04-06 01:28:16 PDT
Created attachment 395554 [details]
Patch
Comment 2 Eric Carlson 2020-04-06 09:25:38 PDT
Comment on attachment 395554 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        Create a WebAudioBufferList once (without any buffer allocation) and set the audio buffer pointer

s/Create/create/

> Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:81
> +    if (!m_audioBufferList || m_sampleRate != sampleRate || m_numberOfChannels != numberOfChannels) {
> +        m_streamDescription = streamDescription(sampleRate, numberOfChannels);
> +        m_audioBufferList = makeUnique<WebAudioBufferList>(m_streamDescription);
> +    }

Don't you need to set m_sampleRate and m_numberOfChannels?
Comment 3 youenn fablet 2020-04-06 12:57:22 PDT
Comment on attachment 395554 [details]
Patch

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

> Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:71
> +    ALWAYS_LOG_IF(loggerPtr() && !(++m_chunksReceived % 200), LOGIDENTIFIER, "chunk ", m_chunksReceived);

Will also dispatch that logging to the main thread since that might disrupt the audio pipeline otherwise.
Comment 4 youenn fablet 2020-04-07 01:46:19 PDT
Created attachment 395663 [details]
Patch for landing
Comment 5 EWS 2020-04-07 04:14:06 PDT
Committed r259632: <https://trac.webkit.org/changeset/259632>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395663 [details].
Comment 6 Radar WebKit Bug Importer 2020-04-07 04:15:15 PDT
<rdar://problem/61387440>