⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 274819 in webkit


Ignore:
Timestamp:
Mar 22, 2021, 4:57:35 PM (5 years ago)
Author:
eric.carlson@apple.com
Message:

AVAudioSessionCaptureDeviceManager should use crossThreadCopy
https://bugs.webkit.org/show_bug.cgi?id=223565
<rdar://75480589>

Reviewed by Youenn Fablet.

Tested manually, this can only be tested on device.

  • platform/mediastream/CaptureDevice.h: Change access restriction for member

variables from private: to protected: so derived classes can access them
directly.

  • platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
  • platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:

(WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
(WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.

  • platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:

(WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
WTFMove(deviceList).isolatedCopy() when moving from AVAudioSession queue
to main thread.
(WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r274818 r274819  
     12021-03-22  Eric Carlson  <eric.carlson@apple.com>
     2
     3        AVAudioSessionCaptureDeviceManager should use crossThreadCopy
     4        https://bugs.webkit.org/show_bug.cgi?id=223565
     5        <rdar://75480589>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Tested manually, this can only be tested on device.
     10
     11        * platform/mediastream/CaptureDevice.h: Change access restriction for member
     12        variables from `private:` to `protected:` so derived classes can access them
     13        directly.
     14
     15        * platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
     16        * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
     17        (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
     18        (WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.
     19
     20        * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
     21        (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
     22        `WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
     23        to main thread.
     24        (WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.
     25
    1262021-03-22  Patrick Angle  <pangle@apple.com>
    227
  • trunk/Source/WebCore/platform/mediastream/CaptureDevice.h

    r270986 r274819  
    131131#endif
    132132
    133 private:
     133protected:
    134134    String m_persistentId;
    135135    DeviceType m_type { DeviceType::Unknown };
  • trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.h

    r269688 r274819  
    4040    virtual ~AVAudioSessionCaptureDevice() = default;
    4141
     42    AVAudioSessionCaptureDevice isolatedCopy() &&;
     43
    4244private:
    4345    AVAudioSessionCaptureDevice(AVAudioSessionPortDescription *deviceInput, AVAudioSessionPortDescription *defaultInput);
     46    AVAudioSessionCaptureDevice(const String& persistentId, DeviceType, const String& label, const String& groupId, bool isEnabled, bool isDefault, bool isMock);
    4447};
    4548
  • trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm

    r269688 r274819  
    4545}
    4646
     47AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice(const String& persistentId, DeviceType type, const String& label, const String& groupId, bool isEnabled, bool isDefault, bool isMock)
     48    : CaptureDevice(persistentId, type, label, groupId)
     49{
     50    setEnabled(isEnabled);
     51    setIsDefault(isDefault);
     52    setIsMockDevice(isMock);
     53}
     54
     55AVAudioSessionCaptureDevice AVAudioSessionCaptureDevice::isolatedCopy() &&
     56{
     57    return {
     58        WTFMove(m_persistentId).isolatedCopy(),
     59        m_type,
     60        WTFMove(m_label).isolatedCopy(),
     61        WTFMove(m_groupId).isolatedCopy(),
     62        m_enabled,
     63        m_default,
     64        m_isMockDevice,
     65    };
     66}
     67
    4768}
    4869
  • trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm

    r274296 r274819  
    164164        newAudioDevices = retrieveAudioSessionCaptureDevices();
    165165    });
    166     setAudioCaptureDevices(WTFMove(newAudioDevices));
     166    setAudioCaptureDevices(WTFMove(newAudioDevices).isolatedCopy());
    167167}
    168168
     
    179179    m_dispatchQueue->dispatch([this, completion = WTFMove(completion)] () mutable {
    180180        auto newAudioDevices = retrieveAudioSessionCaptureDevices();
    181         callOnWebThreadOrDispatchAsyncOnMainThread(makeBlockPtr([this, completion = WTFMove(completion), newAudioDevices = WTFMove(newAudioDevices)] () mutable {
     181        callOnWebThreadOrDispatchAsyncOnMainThread(makeBlockPtr([this, completion = WTFMove(completion), newAudioDevices = WTFMove(newAudioDevices).isolatedCopy()] () mutable {
    182182            setAudioCaptureDevices(WTFMove(newAudioDevices));
    183183            completion(copyToVector(*m_devices));
Note: See TracChangeset for help on using the changeset viewer.