Bug 223565 - Add AVAudioSessionCaptureDeviceManager::isolatedCopy and use it to copy device list calculated on background queue
Summary: Add AVAudioSessionCaptureDeviceManager::isolatedCopy and use it to copy devic...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-21 20:24 PDT by Eric Carlson
Modified: 2021-03-22 17:52 PDT (History)
8 users (show)

See Also:


Attachments
Patch (5.14 KB, patch)
2021-03-21 20:34 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing (5.83 KB, patch)
2021-03-22 10:15 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Updated patch for landing (5.85 KB, patch)
2021-03-22 14:16 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

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