Title: [259858] trunk/Source/WebCore
Revision
259858
Author
[email protected]
Date
2020-04-10 03:32:59 -0700 (Fri, 10 Apr 2020)

Log Message

[EME][GStreamer] Relax proxy initialization assert
https://bugs.webkit.org/show_bug.cgi?id=210258

Reviewed by Xabier Rodriguez-Calvar.

update() may be called on a session before its parent MediaKeys object
has been associated with a media element. Supporting this is officially
optional, but enough sites (including the W3C EME tests) depend on this
optional behaviour that we should support it.

Covered by imported/w3c/web-platform-tests/encrypted-media.

* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMInstanceProxy::mergeKeysFrom): Since the background
proxy may not be installed yet, don't ASSERT() it exists.
* platform/encryptedmedia/CDMProxy.h:
(WebCore::KeyStore::hasKeys const):
(WebCore::CDMInstanceProxy::setProxy): Now, when the background
proxy is installed, check if any keys have been made available as
described above, and if so, set them.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259857 => 259858)


--- trunk/Source/WebCore/ChangeLog	2020-04-10 10:32:42 UTC (rev 259857)
+++ trunk/Source/WebCore/ChangeLog	2020-04-10 10:32:59 UTC (rev 259858)
@@ -1,3 +1,26 @@
+2020-04-10  Charlie Turner  <[email protected]>
+
+        [EME][GStreamer] Relax proxy initialization assert
+        https://bugs.webkit.org/show_bug.cgi?id=210258
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        update() may be called on a session before its parent MediaKeys object
+        has been associated with a media element. Supporting this is officially
+        optional, but enough sites (including the W3C EME tests) depend on this
+        optional behaviour that we should support it.
+
+        Covered by imported/w3c/web-platform-tests/encrypted-media.
+
+        * platform/encryptedmedia/CDMProxy.cpp:
+        (WebCore::CDMInstanceProxy::mergeKeysFrom): Since the background
+        proxy may not be installed yet, don't ASSERT() it exists.
+        * platform/encryptedmedia/CDMProxy.h:
+        (WebCore::KeyStore::hasKeys const):
+        (WebCore::CDMInstanceProxy::setProxy): Now, when the background
+        proxy is installed, check if any keys have been made available as
+        described above, and if so, set them.
+
 2020-04-10  Adrian Perez de Castro  <[email protected]>
 
         [GTK] Avoid direct GdkEvent field usage in GtkUtilities.h

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp (259857 => 259858)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp	2020-04-10 10:32:42 UTC (rev 259857)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp	2020-04-10 10:32:59 UTC (rev 259858)
@@ -287,9 +287,10 @@
     // FIXME: Notify JS when appropriate.
     ASSERT(isMainThread());
     m_keyStore.merge(keyStore);
-    LOG(EME, "EME - CDMInstanceProxy - merging keys into proxy instance and notifying CDMProxy of changes");
-    ASSERT(m_cdmProxy);
-    m_cdmProxy->updateKeyStore(keyStore);
+    if (m_cdmProxy) {
+        LOG(EME, "EME - CDMInstanceProxy - merging keys into proxy instance and notifying CDMProxy of changes");
+        m_cdmProxy->updateKeyStore(keyStore);
+    }
 }
 
 void CDMInstanceProxy::removeAllKeysFrom(const KeyStore& keyStore)

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.h (259857 => 259858)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.h	2020-04-10 10:32:42 UTC (rev 259857)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.h	2020-04-10 10:32:59 UTC (rev 259858)
@@ -88,6 +88,7 @@
     bool addKeys(Vector<RefPtr<Key>>&&);
     bool add(RefPtr<Key>&&);
     bool remove(const RefPtr<Key>&);
+    bool hasKeys() const { return m_keys.size(); }
     unsigned numKeys() const { return m_keys.size(); }
     const Vector<uint8_t>& keyValue(const Vector<uint8_t>& keyID) const;
     KeyStatusVector allKeysAsReleased() const;
@@ -151,6 +152,10 @@
     {
         m_cdmProxy = WTFMove(proxy);
         m_cdmProxy->setInstance(this);
+        // The CDM instance may be attached after an update(). Not
+        // recommended, but apps and the W3C test-suite do this.
+        if (m_keyStore.hasKeys())
+            m_cdmProxy->updateKeyStore(m_keyStore);
     }
     void mergeKeysFrom(const KeyStore&);
     void removeAllKeysFrom(const KeyStore&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to