Bug 223565

Summary: Add AVAudioSessionCaptureDeviceManager::isolatedCopy and use it to copy device list calculated on background queue
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: WebRTCAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, glenn, hta, jer.noble, philipj, sergio, tommyw, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing
none
Updated patch for landing none

Description Eric Carlson 2021-03-21 20:24:53 PDT
AVAudioSessionCaptureDeviceManager should use crossThreadCopy on CaptureDevice list allocated on a background queue.
Comment 1 Eric Carlson 2021-03-21 20:25:46 PDT
<rdar://75480589>
Comment 2 Eric Carlson 2021-03-21 20:34:06 PDT
Created attachment 423848 [details]
Patch
Comment 3 youenn fablet 2021-03-22 02:40:27 PDT
Comment on attachment 423848 [details]
Patch

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

> Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.h:42
> +    AVAudioSessionCaptureDevice isolatedCopy() const;

We could try to change it to: AVAudioSessionCaptureDevice isolatedCopy() &&;

> Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:61
> +        groupId().isolatedCopy(),

If we go with isolatedCopy() &&, doing WTFMove(m_persistentId).isolatedCopy(), WTFMove(m_groupId).isolatedCopy() will most probably remove the memory allocation of a new string.
Comment 4 Eric Carlson 2021-03-22 10:15:27 PDT
Created attachment 423905 [details]
Patch for landing
Comment 5 youenn fablet 2021-03-22 11:27:18 PDT
Comment on attachment 423905 [details]
Patch for landing

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

> Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:58
> +        m_persistentId.isolatedCopy(),

WTFMove(m_persistentId) would remove a potential memory allocation.

> Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:61
> +        m_groupId.isolatedCopy(),

Ditto for m_label and m_groupId.
Comment 6 Eric Carlson 2021-03-22 14:16:21 PDT
Created attachment 423938 [details]
Updated patch for landing
Comment 7 EWS 2021-03-22 16:57:40 PDT
Committed r274819: <https://commits.webkit.org/r274819>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423938 [details].