Title: [280400] trunk/Source/WebCore
Revision
280400
Author
eric.carl...@apple.com
Date
2021-07-28 14:43:38 -0700 (Wed, 28 Jul 2021)

Log Message

[iOS] Ignore extra route change notifications
https://bugs.webkit.org/show_bug.cgi?id=228565

Reviewed by Jer Noble.

Tested manually, this only reproduces on iOS hardware.

* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
* platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices): Do
nothing if m_recomputeDevices is true.
(WebCore::AVAudioSessionCaptureDeviceManager::computeCaptureDevices): Don't rebuilding
device list unless m_recomputeDevices is set. Clear m_recomputeDevices after after
rebuilding list.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280399 => 280400)


--- trunk/Source/WebCore/ChangeLog	2021-07-28 21:36:26 UTC (rev 280399)
+++ trunk/Source/WebCore/ChangeLog	2021-07-28 21:43:38 UTC (rev 280400)
@@ -1,3 +1,20 @@
+2021-07-28  Eric Carlson  <eric.carl...@apple.com>
+
+        [iOS] Ignore extra route change notifications
+        https://bugs.webkit.org/show_bug.cgi?id=228565
+
+        Reviewed by Jer Noble.
+
+        Tested manually, this only reproduces on iOS hardware.
+
+        * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
+        * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
+        (WebCore::AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices): Do
+        nothing if m_recomputeDevices is true.
+        (WebCore::AVAudioSessionCaptureDeviceManager::computeCaptureDevices): Don't rebuilding
+        device list unless m_recomputeDevices is set. Clear m_recomputeDevices after after
+        rebuilding list.
+
 2021-07-28  Ryosuke Niwa  <rn...@webkit.org>
 
         AppHighlightStorage should not inherit privately from RefCounted

Modified: trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h (280399 => 280400)


--- trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h	2021-07-28 21:36:26 UTC (rev 280399)
+++ trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h	2021-07-28 21:43:38 UTC (rev 280400)
@@ -76,6 +76,7 @@
     RetainPtr<AVAudioSession> m_audioSession;
     Ref<WorkQueue> m_dispatchQueue;
     AudioSessionState m_audioSessionState { AudioSessionState::NotNeeded };
+    bool m_recomputeDevices { true };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm (280399 => 280400)


--- trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm	2021-07-28 21:36:26 UTC (rev 280399)
+++ trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm	2021-07-28 21:43:38 UTC (rev 280400)
@@ -146,6 +146,10 @@
 
 void AVAudioSessionCaptureDeviceManager::scheduleUpdateCaptureDevices()
 {
+    if (m_recomputeDevices)
+        return;
+
+    m_recomputeDevices = true;
     computeCaptureDevices([] { });
 }
 
@@ -176,9 +180,13 @@
         });
     }
 
+    if (!m_recomputeDevices)
+        return;
+
     m_dispatchQueue->dispatch([this, completion = WTFMove(completion)] () mutable {
         auto newAudioDevices = retrieveAudioSessionCaptureDevices();
         callOnWebThreadOrDispatchAsyncOnMainThread(makeBlockPtr([this, completion = WTFMove(completion), newAudioDevices = WTFMove(newAudioDevices).isolatedCopy()] () mutable {
+            m_recomputeDevices = false;
             setAudioCaptureDevices(WTFMove(newAudioDevices));
             completion();
         }).get());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to