Bug 209969 - Remove unnecessary memory allocation from RealtimeIncomingAudioSourceCocoa::OnData
Summary: Remove unnecessary memory allocation from RealtimeIncomingAudioSourceCocoa::O...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-03 08:56 PDT by youenn fablet
Modified: 2020-04-07 04:15 PDT (History)
10 users (show)

See Also:


Attachments
Patch (5.01 KB, patch)
2020-04-06 01:28 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (5.52 KB, patch)
2020-04-07 01:46 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>