Title: [260066] trunk/Source/WebCore
Revision
260066
Author
ctur...@igalia.com
Date
2020-04-14 02:58:50 -0700 (Tue, 14 Apr 2020)

Log Message

[EME][CDMProxy] Fix waitingForKey logic
https://bugs.webkit.org/show_bug.cgi?id=210437

Reviewed by Xabier Rodriguez-Calvar.

startedWaitingForKey() was incorrectly flagged. It needs to signal on
the 0->1 transition, here it was only signalling on N->N+1 where N>0.

Also break ASSERTs into separate statements, it makes it easier in a
crash dump to see which conjuct fired.

Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https.html

* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMInstanceProxy::startedWaitingForKey):
(WebCore::CDMInstanceProxy::stoppedWaitingForKey):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260065 => 260066)


--- trunk/Source/WebCore/ChangeLog	2020-04-14 09:50:31 UTC (rev 260065)
+++ trunk/Source/WebCore/ChangeLog	2020-04-14 09:58:50 UTC (rev 260066)
@@ -1,3 +1,22 @@
+2020-04-14  Charlie Turner  <ctur...@igalia.com>
+
+        [EME][CDMProxy] Fix waitingForKey logic
+        https://bugs.webkit.org/show_bug.cgi?id=210437
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        startedWaitingForKey() was incorrectly flagged. It needs to signal on
+        the 0->1 transition, here it was only signalling on N->N+1 where N>0.
+
+        Also break ASSERTs into separate statements, it makes it easier in a
+        crash dump to see which conjuct fired.
+
+        Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https.html
+
+        * platform/encryptedmedia/CDMProxy.cpp:
+        (WebCore::CDMInstanceProxy::startedWaitingForKey):
+        (WebCore::CDMInstanceProxy::stoppedWaitingForKey):
+
 2020-04-14  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Bring back support for rendering scrollbars using the system appearance

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp (260065 => 260066)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp	2020-04-14 09:50:31 UTC (rev 260065)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp	2020-04-14 09:58:50 UTC (rev 260066)
@@ -260,12 +260,14 @@
 
 void CDMInstanceProxy::startedWaitingForKey()
 {
-    ASSERT(!isMainThread() && m_player);
+    ASSERT(!isMainThread());
+    ASSERT(m_player);
+
     bool wasWaitingForKey = m_numDecryptorsWaitingForKey > 0;
     m_numDecryptorsWaitingForKey++;
 
     callOnMainThread([player = m_player, wasWaitingForKey] {
-        if (player && wasWaitingForKey)
+        if (player && !wasWaitingForKey)
             player->waitingForKeyChanged();
     });
 }
@@ -272,7 +274,9 @@
 
 void CDMInstanceProxy::stoppedWaitingForKey()
 {
-    ASSERT(!isMainThread() && m_player && m_numDecryptorsWaitingForKey > 0);
+    ASSERT(!isMainThread());
+    ASSERT(m_player);
+    ASSERT(m_numDecryptorsWaitingForKey > 0);
     m_numDecryptorsWaitingForKey--;
     bool isNobodyWaitingForKey = !m_numDecryptorsWaitingForKey;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to