Title: [252278] tags/Safari-609.1.10.1/Source/WebCore
Revision
252278
Author
[email protected]
Date
2019-11-08 16:51:34 -0800 (Fri, 08 Nov 2019)

Log Message

Cherry-pick r251992. rdar://problem/56648063

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251992 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: tags/Safari-609.1.10.1/Source/WebCore/ChangeLog (252277 => 252278)


--- tags/Safari-609.1.10.1/Source/WebCore/ChangeLog	2019-11-09 00:51:29 UTC (rev 252277)
+++ tags/Safari-609.1.10.1/Source/WebCore/ChangeLog	2019-11-09 00:51:34 UTC (rev 252278)
@@ -1,3 +1,40 @@
+2019-11-07  Alan Coon  <[email protected]>
+
+        Cherry-pick r251992. rdar://problem/56648063
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-11-04  Eric Carlson  <[email protected]>
+
+            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.
+
 2019-11-05  Kocsen Chung  <[email protected]>
 
         Cherry-pick r252079. rdar://problem/56917649

Modified: tags/Safari-609.1.10.1/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp (252277 => 252278)


--- tags/Safari-609.1.10.1/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp	2019-11-09 00:51:29 UTC (rev 252277)
+++ tags/Safari-609.1.10.1/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp	2019-11-09 00:51:34 UTC (rev 252278)
@@ -36,6 +36,7 @@
 #include <CoreMedia/CMSync.h>
 #include <pal/spi/cf/CoreAudioSPI.h>
 #include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
 
 #import <pal/cf/CoreMediaSoftLink.h>
@@ -122,15 +123,12 @@
         refreshAudioCaptureDevices(NotifyIfDevicesHaveChanged::DoNotNotify);
 
         auto listener = ^(UInt32 count, const AudioObjectPropertyAddress properties[]) {
-            for (UInt32 i = 0; i < count; ++i) {
-                const AudioObjectPropertyAddress& property = properties[i];
+            bool notify = false;
+            for (UInt32 i = 0; i < count; ++i)
+                notify |= (properties[i].mSelector == kAudioHardwarePropertyDevices || properties[i].mSelector == kAudioHardwarePropertyDefaultInputDevice);
 
-                if (property.mSelector != kAudioHardwarePropertyDevices)
-                    continue;
-
+            if (notify)
                 CoreAudioCaptureDeviceManager::singleton().refreshAudioCaptureDevices(NotifyIfDevicesHaveChanged::Notify);
-                return;
-            }
         };
 
         AudioObjectPropertyAddress address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
@@ -158,6 +156,8 @@
 
 void CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices(NotifyIfDevicesHaveChanged notify)
 {
+    ASSERT(isMainThread());
+
     AudioObjectPropertyAddress address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
     UInt32 dataSize = 0;
     auto err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &address, 0, nullptr, &dataSize);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to