Title: [274719] trunk/Source/WebCore
Revision
274719
Author
[email protected]
Date
2021-03-19 08:04:04 -0700 (Fri, 19 Mar 2021)

Log Message

[GStreamer][EME] Remove DRM resources release
https://bugs.webkit.org/show_bug.cgi?id=223436

Reviewed by Philippe Normand.

Releasing DRM resources should not be needed according to the
spec. If we needed this in the future because of whatever reason
we need to study it again in some other way.

* platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMInstanceProxy::trackSession): Deleted.
(WebCore::CDMInstanceSessionProxy::removeFromInstanceProxy): Deleted.
* platform/encryptedmedia/CDMProxy.h:
(WebCore::CDMProxy::releaseDecryptionResources): Deleted.
(WebCore::CDMInstanceSessionProxy::releaseDecryptionResources): Deleted.
(WebCore::CDMInstanceProxy::removeSession): Deleted.
(WebCore::CDMInstanceProxy::releaseDecryptionResources): Deleted.
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMInstanceClearKey::createSession):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
(WebCore::CDMProxyClearKey::releaseDecryptionResources): Deleted.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.h:
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMInstanceThunder::createSession):
(WebCore::CDMInstanceSessionThunder::requestLicense):
(WebCore::CDMInstanceSessionThunder::closeSession):
(WebCore::CDMInstanceSessionThunder::removeSessionData):
* platform/graphics/gstreamer/eme/CDMThunder.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274718 => 274719)


--- trunk/Source/WebCore/ChangeLog	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/ChangeLog	2021-03-19 15:04:04 UTC (rev 274719)
@@ -1,3 +1,36 @@
+2021-03-19  Xabier Rodriguez Calvar  <[email protected]>
+
+        [GStreamer][EME] Remove DRM resources release
+        https://bugs.webkit.org/show_bug.cgi?id=223436
+
+        Reviewed by Philippe Normand.
+
+        Releasing DRM resources should not be needed according to the
+        spec. If we needed this in the future because of whatever reason
+        we need to study it again in some other way.
+
+        * platform/encryptedmedia/CDMProxy.cpp:
+        (WebCore::CDMInstanceProxy::trackSession): Deleted.
+        (WebCore::CDMInstanceSessionProxy::removeFromInstanceProxy): Deleted.
+        * platform/encryptedmedia/CDMProxy.h:
+        (WebCore::CDMProxy::releaseDecryptionResources): Deleted.
+        (WebCore::CDMInstanceSessionProxy::releaseDecryptionResources): Deleted.
+        (WebCore::CDMInstanceProxy::removeSession): Deleted.
+        (WebCore::CDMInstanceProxy::releaseDecryptionResources): Deleted.
+        * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
+        (WebCore::CDMInstanceClearKey::createSession):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
+        * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp:
+        (WebCore::CDMProxyClearKey::releaseDecryptionResources): Deleted.
+        * platform/graphics/gstreamer/eme/CDMProxyClearKey.h:
+        * platform/graphics/gstreamer/eme/CDMThunder.cpp:
+        (WebCore::CDMInstanceThunder::createSession):
+        (WebCore::CDMInstanceSessionThunder::requestLicense):
+        (WebCore::CDMInstanceSessionThunder::closeSession):
+        (WebCore::CDMInstanceSessionThunder::removeSessionData):
+        * platform/graphics/gstreamer/eme/CDMThunder.h:
+
 2021-03-19  Devin Rousso  <[email protected]>
 
         CSP headers can block default <video> controls

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp (274718 => 274719)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp	2021-03-19 15:04:04 UTC (rev 274719)
@@ -373,24 +373,11 @@
     m_keyStore.removeAllKeysFrom(keyStore);
 }
 
-void CDMInstanceProxy::trackSession(const CDMInstanceSessionProxy& session)
-{
-    ASSERT(!m_sessions.contains(session));
-    m_sessions.add(session);
-}
-
 CDMInstanceSessionProxy::CDMInstanceSessionProxy(CDMInstanceProxy& instance)
     : m_instance(makeWeakPtr(instance))
 {
 }
 
-void CDMInstanceSessionProxy::removeFromInstanceProxy()
-{
-    if (!m_instance)
-        return;
-    m_instance->removeSession(*this);
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(ENCRYPTED_MEDIA)

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.h (274718 => 274719)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.h	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.h	2021-03-19 15:04:04 UTC (rev 274719)
@@ -158,12 +158,6 @@
     void updateKeyStore(const KeyStore& newKeyStore);
     void setInstance(CDMInstanceProxy*);
 
-    virtual void releaseDecryptionResources()
-    {
-        ASSERT(isMainThread());
-        m_keyStore.removeAllKeys();
-    }
-
 protected:
     RefPtr<KeyHandle> keyHandle(const KeyIDType&) const;
     bool keyAvailable(const KeyIDType&) const;
@@ -212,8 +206,6 @@
 
 class CDMInstanceSessionProxy : public CDMInstanceSession, public CanMakeWeakPtr<CDMInstanceSessionProxy, WeakPtrFactoryInitialization::Eager> {
 public:
-    virtual void releaseDecryptionResources() { m_instance.clear(); }
-    void removeFromInstanceProxy();
 
 protected:
     CDMInstanceSessionProxy(CDMInstanceProxy&);
@@ -249,23 +241,6 @@
     void startedWaitingForKey();
     void stoppedWaitingForKey();
 
-    void removeSession(const CDMInstanceSessionProxy& session) { m_sessions.remove(session); }
-    virtual void releaseDecryptionResources()
-    {
-        ASSERT(isMainThread());
-        m_keyStore.removeAllKeys();
-        for (auto& session : m_sessions)
-            session.releaseDecryptionResources();
-        m_sessions.clear();
-        if (m_cdmProxy) {
-            m_cdmProxy->releaseDecryptionResources();
-            m_cdmProxy = nullptr;
-        }
-    }
-
-protected:
-    void trackSession(const CDMInstanceSessionProxy&);
-
 private:
     RefPtr<CDMProxy> m_cdmProxy;
     // FIXME: WeakPtr for the m_player? This is accessed from background and main threads, it's
@@ -274,7 +249,6 @@
     MediaPlayer* m_player { nullptr }; // FIXME: MainThread<T>?
 
     std::atomic<int> m_numDecryptorsWaitingForKey { 0 };
-    WeakHashSet<CDMInstanceSessionProxy> m_sessions;
 
     KeyStore m_keyStore;
 };

Modified: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp (274718 => 274719)


--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp	2021-03-19 15:04:04 UTC (rev 274719)
@@ -450,9 +450,7 @@
 
 RefPtr<CDMInstanceSession> CDMInstanceClearKey::createSession()
 {
-    auto newSession = adoptRef(new CDMInstanceSessionClearKey(*this));
-    trackSession(*newSession);
-    return newSession;
+    return adoptRef(new CDMInstanceSessionClearKey(*this));
 }
 
 void CDMInstanceSessionClearKey::requestLicense(LicenseType, const AtomString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback&& callback)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (274718 => 274719)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-03-19 15:04:04 UTC (rev 274719)
@@ -262,14 +262,6 @@
     if (m_pipeline)
         gst_element_set_state(m_pipeline.get(), GST_STATE_NULL);
 
-#if ENABLE(ENCRYPTED_MEDIA)
-    {
-        LockHolder lock(m_cdmAttachmentMutex);
-        if (m_cdmInstance)
-            m_cdmInstance->releaseDecryptionResources();
-    }
-#endif
-
     m_player = nullptr;
     m_notifier->invalidate();
 }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp (274718 => 274719)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp	2021-03-19 15:04:04 UTC (rev 274719)
@@ -215,12 +215,6 @@
     return input.isSubsampled() ? cencDecryptSubsampled(input) : cencDecryptFullSample(input);
 }
 
-void CDMProxyClearKey::releaseDecryptionResources()
-{
-    closeGCryptHandle();
-    CDMProxy::releaseDecryptionResources();
-}
-
 void CDMProxyClearKey::closeGCryptHandle()
 {
     if (m_gCryptHandle) {

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.h (274718 => 274719)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.h	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.h	2021-03-19 15:04:04 UTC (rev 274719)
@@ -111,7 +111,6 @@
     bool cencDecryptFullSample(cencDecryptContext&);
     bool cencDecryptSubsampled(cencDecryptContext&);
 
-    void releaseDecryptionResources() final;
     void closeGCryptHandle();
 
     // FIXME: It would be nice to use something in WebCore for crypto...

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp (274718 => 274719)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp	2021-03-19 15:04:04 UTC (rev 274719)
@@ -39,7 +39,6 @@
 #include "GStreamerEMEUtilities.h"
 #include "Logging.h"
 #include "MediaKeyMessageType.h"
-#include "MediaKeyStatus.h"
 #include "NotImplemented.h"
 #include "SharedBuffer.h"
 #include "WebKitThunderDecryptorGStreamer.h"
@@ -328,7 +327,6 @@
 {
     RefPtr<CDMInstanceSessionThunder> newSession = adoptRef(new CDMInstanceSessionThunder(*this));
     ASSERT(newSession);
-    trackSession(*newSession);
     return newSession;
 }
 
@@ -533,7 +531,6 @@
         if (!isValid()) {
             GST_WARNING("created invalid session %s", m_sessionID.utf8().data());
             callback(initData.releaseNonNull(), m_sessionID, false, Failed);
-            removeFromInstanceProxy();
             return;
         }
 
@@ -635,8 +632,6 @@
     if (m_session && !m_sessionID.isEmpty())
         opencdm_session_close(m_session.get());
 
-    removeFromInstanceProxy();
-
     callback();
 }
 
@@ -669,8 +664,6 @@
     });
     if (!m_session || m_sessionID.isEmpty() || opencdm_session_remove(m_session.get()))
         sessionFailure();
-
-    removeFromInstanceProxy();
 }
 
 void CDMInstanceSessionThunder::storeRecordOfKeyUsage(const String&)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h (274718 => 274719)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h	2021-03-19 14:48:10 UTC (rev 274718)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h	2021-03-19 15:04:04 UTC (rev 274719)
@@ -36,6 +36,7 @@
 #include "CDMPrivate.h"
 #include "CDMProxy.h"
 #include "GStreamerEMEUtilities.h"
+#include "MediaKeyStatus.h"
 #include "SharedBuffer.h"
 #include <wtf/WeakPtr.h>
 
@@ -119,13 +120,6 @@
 
     OpenCDMSystem& thunderSystem() const { return *m_thunderSystem.get(); };
 
-    void releaseDecryptionResources() final
-    {
-        ASSERT(isMainThread());
-        CDMInstanceProxy::releaseDecryptionResources();
-        m_thunderSystem.reset(nullptr);
-    }
-
 private:
     Thunder::UniqueThunderSystem m_thunderSystem;
     String m_keySystem;
@@ -147,14 +141,6 @@
     void setClient(WeakPtr<CDMInstanceSessionClient>&& client) final { m_client = WTFMove(client); }
     void clearClient() final { m_client.clear(); }
 
-    void releaseDecryptionResources() final
-    {
-        ASSERT(isMainThread());
-        m_keyStore.removeAllKeys();
-        m_session.reset(nullptr);
-        CDMInstanceSessionProxy::releaseDecryptionResources();
-    }
-
 private:
     Optional<CDMInstanceThunder&> cdmInstanceThunder() const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to