Title: [265089] trunk/Source/WebKit
Revision
265089
Author
[email protected]
Date
2020-07-30 10:30:44 -0700 (Thu, 30 Jul 2020)

Log Message

ASSERTION FAILED: !isInRoutingArbitrationForArbitrator(proxy) in WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator
https://bugs.webkit.org/show_bug.cgi?id=214904

Reviewed by Jer Noble.

Only add an AudioSessionRoutingArbitratorProxy to the WeakHashSet (m_arbitrators)
if the routing arbitration is completed successfully.

* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (265088 => 265089)


--- trunk/Source/WebKit/ChangeLog	2020-07-30 17:12:33 UTC (rev 265088)
+++ trunk/Source/WebKit/ChangeLog	2020-07-30 17:30:44 UTC (rev 265089)
@@ -1,3 +1,16 @@
+2020-07-30  Peng Liu  <[email protected]>
+
+        ASSERTION FAILED: !isInRoutingArbitrationForArbitrator(proxy) in WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator
+        https://bugs.webkit.org/show_bug.cgi?id=214904
+
+        Reviewed by Jer Noble.
+
+        Only add an AudioSessionRoutingArbitratorProxy to the WeakHashSet (m_arbitrators)
+        if the routing arbitration is completed successfully.
+
+        * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
+        (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
+
 2020-07-30  Per Arne Vollan  <[email protected]>
 
         Remember to check entitlement before communicating over XPC

Modified: trunk/Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm (265088 => 265089)


--- trunk/Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm	2020-07-30 17:12:33 UTC (rev 265088)
+++ trunk/Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm	2020-07-30 17:30:44 UTC (rev 265089)
@@ -74,10 +74,15 @@
 void SharedArbitrator::beginRoutingArbitrationForArbitrator(AudioSessionRoutingArbitratorProxy& proxy, ArbitrationCallback&& callback)
 {
     ASSERT(!isInRoutingArbitrationForArbitrator(proxy));
-    m_arbitrators.add(proxy);
 
     if (m_setupArbitrationOngoing) {
-        m_enqueuedCallbacks.append(WTFMove(callback));
+        m_enqueuedCallbacks.append([this, weakProxy = makeWeakPtr(proxy), callback = WTFMove(callback)] (RoutingArbitrationError error, DefaultRouteChanged routeChanged) mutable {
+            if (error == RoutingArbitrationError::None && weakProxy)
+                m_arbitrators.add(*weakProxy);
+
+            callback(error, routeChanged);
+        });
+
         return;
     }
 
@@ -85,6 +90,7 @@
 
     if (m_currentCategory) {
         if (*m_currentCategory >= requestedCategory) {
+            m_arbitrators.add(proxy);
             callback(RoutingArbitrationError::None, DefaultRouteChanged::No);
             return;
         }
@@ -110,8 +116,13 @@
     }
 
     m_setupArbitrationOngoing = true;
-    m_enqueuedCallbacks.append(WTFMove(callback));
+    m_enqueuedCallbacks.append([this, weakProxy = makeWeakPtr(proxy), callback = WTFMove(callback)] (RoutingArbitrationError error, DefaultRouteChanged routeChanged) mutable {
+        if (error == RoutingArbitrationError::None && weakProxy)
+            m_arbitrators.add(*weakProxy);
 
+        callback(error, routeChanged);
+    });
+
     [[PAL::getAVAudioRoutingArbiterClass() sharedRoutingArbiter] beginArbitrationWithCategory:arbitrationCategory completionHandler:[this](BOOL defaultDeviceChanged, NSError * _Nullable error) {
         callOnMainRunLoop([this, defaultDeviceChanged, error = retainPtr(error)] {
             if (error)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to