Changeset 251992 in webkit


Ignore:
Timestamp:
Nov 4, 2019 8:42:31 AM (4 years ago)
Author:
eric.carlson@apple.com
Message:

enumerateDevices() doesn't return correct list of devices after device was changed by user in a system preferences
https://bugs.webkit.org/show_bug.cgi?id=203407
<rdar://problem/56648063>

Reviewed by Youenn Fablet.

Tested manually as this doesn't reproduce with mock capture devices.

  • platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:

(WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices): Refresh the list of capture
devices when the default input device changes.
(WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices): Assert if not called
on the main thread.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r251991 r251992  
     12019-11-04  Eric Carlson  <eric.carlson@apple.com>
     2
     3        enumerateDevices() doesn't return correct list of devices after device was changed by user in a system preferences
     4        https://bugs.webkit.org/show_bug.cgi?id=203407
     5        <rdar://problem/56648063>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Tested manually as this doesn't reproduce with mock capture devices.
     10
     11        * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
     12        (WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices): Refresh the list of capture
     13        devices when the default input device changes.
     14        (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices): Assert if not called
     15        on the main thread.
     16
    1172019-11-04  Andy Estes  <aestes@apple.com>
    218
  • trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp

    r249154 r251992  
    3737#include <pal/spi/cf/CoreAudioSPI.h>
    3838#include <wtf/Assertions.h>
     39#include <wtf/MainThread.h>
    3940#include <wtf/NeverDestroyed.h>
    4041
     
    123124
    124125        auto listener = ^(UInt32 count, const AudioObjectPropertyAddress properties[]) {
    125             for (UInt32 i = 0; i < count; ++i) {
    126                 const AudioObjectPropertyAddress& property = properties[i];
    127 
    128                 if (property.mSelector != kAudioHardwarePropertyDevices)
    129                     continue;
    130 
     126            bool notify = false;
     127            for (UInt32 i = 0; i < count; ++i)
     128                notify |= (properties[i].mSelector == kAudioHardwarePropertyDevices || properties[i].mSelector == kAudioHardwarePropertyDefaultInputDevice);
     129
     130            if (notify)
    131131                CoreAudioCaptureDeviceManager::singleton().refreshAudioCaptureDevices(NotifyIfDevicesHaveChanged::Notify);
    132                 return;
    133             }
    134132        };
    135133
     
    159157void CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices(NotifyIfDevicesHaveChanged notify)
    160158{
     159    ASSERT(isMainThread());
     160
    161161    AudioObjectPropertyAddress address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
    162162    UInt32 dataSize = 0;
Note: See TracChangeset for help on using the changeset viewer.