Title: [290206] trunk
Revision
290206
Author
[email protected]
Date
2022-02-19 06:45:45 -0800 (Sat, 19 Feb 2022)

Log Message

[WPE][GTK] Enable Thunder and remove old Clearkey CDM/Decryptor
https://bugs.webkit.org/show_bug.cgi?id=235492

Patch by Philippe Normand <[email protected]> on 2022-02-19
Reviewed by Xabier Rodriguez-Calvar.

.:

Enable Thunder in developer builds, this is now needed for the clearkey EME layout tests.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

Source/WebCore:

The Thunder decryptor can now handle ClearKey payloads, as long as the underlying ocdm
library advertises it as supported. Thus the dedicated ClearKey decryptor is no longer
needed and can be removed.

Covered by existing EME ClearKey layout tests.

* platform/GStreamer.cmake:
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::registerWebKitGStreamerElements):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
* platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp:
(WebCore::CDMFactory::platformRegisterFactories):
* platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp: Removed.
(): Deleted.
(WebCore::CDMProxyFactoryClearKey::singleton): Deleted.
(WebCore::CDMProxyFactoryClearKey::createCDMProxy): Deleted.
(WebCore::CDMProxyFactoryClearKey::supportsKeySystem): Deleted.
(WebCore::CDMProxyClearKey::~CDMProxyClearKey): Deleted.
(WebCore::CDMProxyClearKey::cencSetCounterVector): Deleted.
(WebCore::CDMProxyClearKey::cencSetDecryptionKey): Deleted.
(WebCore::CDMProxyClearKey::cencDecryptFullSample): Deleted.
(WebCore::CDMProxyClearKey::cencDecryptSubsampled): Deleted.
(WebCore::CDMProxyClearKey::cencDecrypt): Deleted.
(WebCore::CDMProxyClearKey::closeGCryptHandle): Deleted.
(WebCore::CDMProxyClearKey::gCryptHandle): Deleted.
* platform/graphics/gstreamer/eme/CDMProxyClearKey.h: Removed.
(): Deleted.
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMFactoryThunder::supportedKeySystems const):
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: Removed.
(webkit_media_clear_key_decrypt_class_init): Deleted.
(protectionSystemId): Deleted.
(cdmProxyAttached): Deleted.
(decrypt): Deleted.
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h: Removed.
* platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
* platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
(webKitMediaSrcSendEvent):

LayoutTests:

Update EME ClearKey baselines, a few more tests were enabled.

* platform/glib/TestExpectations:
* platform/glib/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt: Added.
* platform/wpe/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/ChangeLog (290205 => 290206)


--- trunk/ChangeLog	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/ChangeLog	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,3 +1,15 @@
+2022-02-19  Philippe Normand  <[email protected]>
+
+        [WPE][GTK] Enable Thunder and remove old Clearkey CDM/Decryptor
+        https://bugs.webkit.org/show_bug.cgi?id=235492
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Enable Thunder in developer builds, this is now needed for the clearkey EME layout tests.
+
+        * Source/cmake/OptionsGTK.cmake:
+        * Source/cmake/OptionsWPE.cmake:
+
 2022-02-18  Robert Jenner  <[email protected]>
 
         Unreviewed, reverting r290149.

Modified: trunk/LayoutTests/ChangeLog (290205 => 290206)


--- trunk/LayoutTests/ChangeLog	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/LayoutTests/ChangeLog	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,3 +1,16 @@
+2022-02-19  Philippe Normand  <[email protected]>
+
+        [WPE][GTK] Enable Thunder and remove old Clearkey CDM/Decryptor
+        https://bugs.webkit.org/show_bug.cgi?id=235492
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Update EME ClearKey baselines, a few more tests were enabled.
+
+        * platform/glib/TestExpectations:
+        * platform/glib/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt: Added.
+        * platform/wpe/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt: Removed.
+
 2022-02-18  Ben Nham  <[email protected]>
 
         Hook up PushManager to permission state

Modified: trunk/LayoutTests/platform/glib/TestExpectations (290205 => 290206)


--- trunk/LayoutTests/platform/glib/TestExpectations	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/LayoutTests/platform/glib/TestExpectations	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1711,26 +1711,26 @@
 webkit.org/b/189345 http/tests/media/clearkey/collect-webkit-media-session.html [ Skip ]
 
 media/encrypted-media [ Pass ]
-media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse-multikey.html [ Skip ]
-webkit.org/b/205857 media/encrypted-media/mock-MediaKeySession-generateRequest.html [ Skip ]
 webkit.org/b/205857 media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html [ Skip ]
 webkit.org/b/205860 media/encrypted-media/mock-MediaKeySession-remove.html [ Skip ]
 
-webkit.org/b/190578 media/encrypted-media/mock-MediaKeySystemAccess.html [ Skip ]
-
 webkit.org/b/190991 media/encrypted-media/encrypted-media-constants.html [ Failure ]
 webkit.org/b/190991 media/encrypted-media/encrypted-media-is-type-supported.html [ Failure ]
 webkit.org/b/190991 media/encrypted-media/encrypted-media-session-lifetime.html [ Timeout ]
-# Encrypted WebM is not supported yet.
-webkit.org/b/189196 media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html [ Skip ]
 
 # Web platform tests
 # Disable and selectively pass, since half the tests require a real DRM system.
 webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/ [ Skip ]
+webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-license-events.https.html [ Skip ]
+webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-usage-record-events.https.html [ Skip ]
+webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-usage-record.https.html [ Skip ]
+webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-retrieve-destroy-persistent-license.https.html [ Skip ]
+webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-retrieve-persistent-usage-record.https.html [ Skip ]
 webkit.org/b/211840 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-retrieve-persistent-license.https.html [ Failure ]
 webkit.org/b/211840 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-destroy-persistent-license.https.html [ Failure ]
 webkit.org/b/190991 imported/w3c/web-platform-tests/encrypted-media/clearkey-check-status-for-hdcp.https.html [ Failure ]
 webkit.org/b/211375 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted-segmented.https.html [ Skip ]
+webkit.org/b/198830 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary.https.html [ Crash Pass ]
 webkit.org/b/210113 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-reset-src-after-setmediakeys.https.html [ Failure ]
 webkit.org/b/210390 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-setmediakeys-again-after-resetting-src.https.html [ Crash Pass ]
 webkit.org/b/210965 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential-readyState.https.html [ Failure ]
@@ -1737,6 +1737,7 @@
 webkit.org/b/210966 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-setmediakeys-again-after-playback.https.html [ Crash Pass ]
 webkit.org/b/178707 imported/w3c/web-platform-tests/encrypted-media/encrypted-media-default-feature-policy.https.sub.html [ Skip ]
 
+imported/w3c/web-platform-tests/encrypted-media/idlharness.https.html [ Pass ]
 imported/w3c/web-platform-tests/encrypted-media/clearkey-check-encryption-scheme.https.html [ Pass ]
 imported/w3c/web-platform-tests/encrypted-media/clearkey-check-initdata-type.https.html [ Pass ]
 imported/w3c/web-platform-tests/encrypted-media/clearkey-events.https.html [ Pass ]

Modified: trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-after-src.https-expected.txt (290205 => 290206)


--- trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-after-src.https-expected.txt	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-after-src.https-expected.txt	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,5 +1,3 @@
 
-Harness Error (TIMEOUT), message = null
+FAIL org.w3.clearkey, temporary, mp4, playback, setMediaKeys after setting video.src assert_unreached: InvalidStateError: The object is in an invalid state. Reached unreachable code
 
-TIMEOUT org.w3.clearkey, temporary, mp4, playback, setMediaKeys after setting video.src Test timed out
-

Added: trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt (0 => 290206)


--- trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/glib/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt	2022-02-19 14:45:45 UTC (rev 290206)
@@ -0,0 +1,97 @@
+Description
+
+This test verifies that implementations of the Encrypted Media Extensions API match its WebIDL definition.
+
+
+PASS idl_test setup
+PASS idl_test validation
+PASS Partial interface Navigator: original interface defined
+PASS Partial interface Navigator: valid exposure set
+PASS Partial interface Navigator: member names are unique
+PASS Partial interface HTMLMediaElement: original interface defined
+PASS Partial interface HTMLMediaElement: valid exposure set
+PASS Partial interface HTMLMediaElement: member names are unique
+PASS Partial interface mixin NavigatorID: member names are unique
+PASS HTMLElement includes GlobalEventHandlers: member names are unique
+PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique
+PASS HTMLElement includes ElementContentEditable: member names are unique
+PASS HTMLElement includes HTMLOrSVGElement: member names are unique
+PASS Navigator includes NavigatorID: member names are unique
+PASS Navigator includes NavigatorLanguage: member names are unique
+PASS Navigator includes NavigatorOnLine: member names are unique
+PASS Navigator includes NavigatorContentUtils: member names are unique
+PASS Navigator includes NavigatorCookies: member names are unique
+PASS Navigator includes NavigatorPlugins: member names are unique
+PASS Navigator includes NavigatorConcurrentHardware: member names are unique
+PASS Element includes ParentNode: member names are unique
+PASS Element includes NonDocumentTypeChildNode: member names are unique
+PASS Element includes ChildNode: member names are unique
+PASS Element includes Slottable: member names are unique
+PASS MediaKeySystemAccess interface: existence and properties of interface object
+PASS MediaKeySystemAccess interface object length
+PASS MediaKeySystemAccess interface object name
+PASS MediaKeySystemAccess interface: existence and properties of interface prototype object
+PASS MediaKeySystemAccess interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaKeySystemAccess interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaKeySystemAccess interface: attribute keySystem
+PASS MediaKeySystemAccess interface: operation getConfiguration()
+PASS MediaKeySystemAccess interface: operation createMediaKeys()
+PASS MediaKeys interface: existence and properties of interface object
+PASS MediaKeys interface object length
+PASS MediaKeys interface object name
+PASS MediaKeys interface: existence and properties of interface prototype object
+PASS MediaKeys interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaKeys interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaKeys interface: operation createSession(optional MediaKeySessionType)
+PASS MediaKeys interface: operation setServerCertificate(BufferSource)
+PASS MediaKeySession interface: existence and properties of interface object
+PASS MediaKeySession interface object length
+PASS MediaKeySession interface object name
+PASS MediaKeySession interface: existence and properties of interface prototype object
+PASS MediaKeySession interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaKeySession interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaKeySession interface: attribute sessionId
+PASS MediaKeySession interface: attribute expiration
+PASS MediaKeySession interface: attribute closed
+PASS MediaKeySession interface: attribute keyStatuses
+PASS MediaKeySession interface: attribute onkeystatuseschange
+PASS MediaKeySession interface: attribute onmessage
+PASS MediaKeySession interface: operation generateRequest(DOMString, BufferSource)
+PASS MediaKeySession interface: operation load(DOMString)
+PASS MediaKeySession interface: operation update(BufferSource)
+PASS MediaKeySession interface: operation close()
+PASS MediaKeySession interface: operation remove()
+PASS MediaKeyStatusMap interface: existence and properties of interface object
+PASS MediaKeyStatusMap interface object length
+PASS MediaKeyStatusMap interface object name
+PASS MediaKeyStatusMap interface: existence and properties of interface prototype object
+PASS MediaKeyStatusMap interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaKeyStatusMap interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaKeyStatusMap interface: iterable<BufferSource, MediaKeyStatus>
+PASS MediaKeyStatusMap interface: attribute size
+PASS MediaKeyStatusMap interface: operation has(BufferSource)
+PASS MediaKeyStatusMap interface: operation get(BufferSource)
+PASS MediaKeyMessageEvent interface: existence and properties of interface object
+PASS MediaKeyMessageEvent interface object length
+PASS MediaKeyMessageEvent interface object name
+PASS MediaKeyMessageEvent interface: existence and properties of interface prototype object
+PASS MediaKeyMessageEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaKeyMessageEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaKeyMessageEvent interface: attribute messageType
+PASS MediaKeyMessageEvent interface: attribute message
+PASS MediaEncryptedEvent interface: existence and properties of interface object
+PASS MediaEncryptedEvent interface object length
+PASS MediaEncryptedEvent interface object name
+PASS MediaEncryptedEvent interface: existence and properties of interface prototype object
+PASS MediaEncryptedEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaEncryptedEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaEncryptedEvent interface: attribute initDataType
+PASS MediaEncryptedEvent interface: attribute initData
+PASS HTMLMediaElement interface: attribute mediaKeys
+PASS HTMLMediaElement interface: attribute onencrypted
+PASS HTMLMediaElement interface: attribute onwaitingforkey
+PASS HTMLMediaElement interface: operation setMediaKeys(MediaKeys?)
+PASS Navigator interface: operation requestMediaKeySystemAccess(DOMString, sequence<MediaKeySystemConfiguration>)
+PASS Navigator interface: navigator must inherit property "requestMediaKeySystemAccess(DOMString, sequence<MediaKeySystemConfiguration>)" with the proper type
+PASS Navigator interface: calling requestMediaKeySystemAccess(DOMString, sequence<MediaKeySystemConfiguration>) on navigator with too few arguments must throw TypeError
+

Deleted: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt (290205 => 290206)


--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/idlharness.https-expected.txt	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,15 +0,0 @@
-CONSOLE MESSAGE: Unhandled Promise Rejection: MediaKeyMessageEventInit inherits EventInit, but EventInit is undefined.
-Description
-
-This test verifies that implementations of the Encrypted Media Extensions API match its WebIDL definition.
-
-
-Harness Error (FAIL), message = Unhandled rejection: MediaKeyMessageEventInit inherits EventInit, but EventInit is undefined.
-
-PASS Partial interface Navigator: original interface defined
-PASS Partial interface Navigator: valid exposure set
-PASS Partial interface Navigator: member names are unique
-PASS Partial interface HTMLMediaElement: original interface defined
-PASS Partial interface HTMLMediaElement: valid exposure set
-PASS Partial interface HTMLMediaElement: member names are unique
-

Modified: trunk/Source/WebCore/ChangeLog (290205 => 290206)


--- trunk/Source/WebCore/ChangeLog	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/ChangeLog	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,3 +1,49 @@
+2022-02-19  Philippe Normand  <[email protected]>
+
+        [WPE][GTK] Enable Thunder and remove old Clearkey CDM/Decryptor
+        https://bugs.webkit.org/show_bug.cgi?id=235492
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The Thunder decryptor can now handle ClearKey payloads, as long as the underlying ocdm
+        library advertises it as supported. Thus the dedicated ClearKey decryptor is no longer
+        needed and can be removed.
+
+        Covered by existing EME ClearKey layout tests.
+
+        * platform/GStreamer.cmake:
+        * platform/graphics/gstreamer/GStreamerCommon.cpp:
+        (WebCore::registerWebKitGStreamerElements):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        * platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp:
+        (WebCore::CDMFactory::platformRegisterFactories):
+        * platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp: Removed.
+        (): Deleted.
+        (WebCore::CDMProxyFactoryClearKey::singleton): Deleted.
+        (WebCore::CDMProxyFactoryClearKey::createCDMProxy): Deleted.
+        (WebCore::CDMProxyFactoryClearKey::supportsKeySystem): Deleted.
+        (WebCore::CDMProxyClearKey::~CDMProxyClearKey): Deleted.
+        (WebCore::CDMProxyClearKey::cencSetCounterVector): Deleted.
+        (WebCore::CDMProxyClearKey::cencSetDecryptionKey): Deleted.
+        (WebCore::CDMProxyClearKey::cencDecryptFullSample): Deleted.
+        (WebCore::CDMProxyClearKey::cencDecryptSubsampled): Deleted.
+        (WebCore::CDMProxyClearKey::cencDecrypt): Deleted.
+        (WebCore::CDMProxyClearKey::closeGCryptHandle): Deleted.
+        (WebCore::CDMProxyClearKey::gCryptHandle): Deleted.
+        * platform/graphics/gstreamer/eme/CDMProxyClearKey.h: Removed.
+        (): Deleted.
+        * platform/graphics/gstreamer/eme/CDMThunder.cpp:
+        (WebCore::CDMFactoryThunder::supportedKeySystems const):
+        * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp: Removed.
+        (webkit_media_clear_key_decrypt_class_init): Deleted.
+        (protectionSystemId): Deleted.
+        (cdmProxyAttached): Deleted.
+        (decrypt): Deleted.
+        * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h: Removed.
+        * platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
+        * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
+        (webKitMediaSrcSendEvent):
+
 2022-02-19  Antti Koivisto  <[email protected]>
 
         [CSS Container Queries] Match container queries correctly in non-rendered subtrees

Modified: trunk/Source/WebCore/platform/GStreamer.cmake (290205 => 290206)


--- trunk/Source/WebCore/platform/GStreamer.cmake	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/GStreamer.cmake	2022-02-19 14:45:45 UTC (rev 290206)
@@ -31,7 +31,6 @@
         platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
 
         platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp
-        platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp
         platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp
 
         platform/graphics/gstreamer/mse/AppendPipeline.cpp
@@ -186,7 +185,6 @@
 if (ENABLE_ENCRYPTED_MEDIA)
     list(APPEND WebCore_SOURCES
         platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp
-        platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp
     )
 
     if (ENABLE_THUNDER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -59,12 +59,10 @@
 #include "GStreamerVideoEncoder.h"
 #endif
 
-#if ENABLE(ENCRYPTED_MEDIA)
-#include "WebKitClearKeyDecryptorGStreamer.h"
-#if ENABLE(THUNDER)
+#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
+#include "CDMThunder.h"
 #include "WebKitThunderDecryptorGStreamer.h"
 #endif
-#endif
 
 #if ENABLE(VIDEO)
 #include "WebKitWebSourceGStreamer.h"
@@ -312,10 +310,20 @@
         gst_init_static_plugins();
 #endif
 
-#if ENABLE(ENCRYPTED_MEDIA)
-        gst_element_register(nullptr, "webkitclearkey", GST_RANK_PRIMARY + 200, WEBKIT_TYPE_MEDIA_CK_DECRYPT);
+#if ENABLE(ENCRYPTED_MEDIA) && ENABLE(THUNDER)
+        if (!CDMFactoryThunder::singleton().supportedKeySystems().isEmpty()) {
+            unsigned thunderRank = isThunderRanked() ? 300 : 100;
+            gst_element_register(nullptr, "webkitthunder", GST_RANK_PRIMARY + thunderRank, WEBKIT_TYPE_MEDIA_THUNDER_DECRYPT);
+        }
+#ifndef NDEBUG
+        else if (isThunderRanked()) {
+            GST_WARNING("Thunder is up-ranked as preferred decryptor but Thunder is not supporting any encryption system. Is "
+                "Thunder running? Are the plugins built?");
+        }
 #endif
 
+#endif
+
 #if ENABLE(MEDIA_STREAM)
         gst_element_register(nullptr, "mediastreamsrc", GST_RANK_PRIMARY, WEBKIT_TYPE_MEDIA_STREAM_SRC);
         gst_element_register(nullptr, "webrtcvideoencoder", GST_RANK_PRIMARY + 100, WEBKIT_TYPE_WEBRTC_VIDEO_ENCODER);

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -66,7 +66,6 @@
 
 #if ENABLE(ENCRYPTED_MEDIA)
 #include "CDMInstance.h"
-#include "CDMProxyClearKey.h"
 #include "GStreamerEMEUtilities.h"
 #include "SharedBuffer.h"
 #include "WebKitCommonEncryptionDecryptorGStreamer.h"

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -31,7 +31,7 @@
 
 #if ENABLE(ENCRYPTED_MEDIA)
 
-#include "CDMProxyClearKey.h"
+#include "CDMProxy.h"
 
 #if ENABLE(THUNDER)
 #include "CDMThunder.h"
@@ -41,9 +41,10 @@
 
 void CDMFactory::platformRegisterFactories(Vector<CDMFactory*>& factories)
 {
-    factories.append(&CDMFactoryClearKey::singleton());
 #if ENABLE(THUNDER)
     factories.append(&CDMFactoryThunder::singleton());
+#else
+    UNUSED_PARAM(factories);
 #endif
 }
 
@@ -51,12 +52,9 @@
 {
     Vector<CDMProxyFactory*> factories;
 #if ENABLE(THUNDER)
-    factories.reserveInitialCapacity(2);
+    factories.reserveInitialCapacity(1);
     factories.uncheckedAppend(&CDMFactoryThunder::singleton());
-#else
-    factories.reserveInitialCapacity(1);
 #endif
-    factories.uncheckedAppend(&CDMProxyFactoryClearKey::singleton());
     return factories;
 }
 

Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,244 +0,0 @@
-/*
- * Copyright (C) 2020 Metrological Group B.V.
- * Copyright (C) 2020 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials provided
- *    with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CDMProxyClearKey.h"
-
-#if ENABLE(ENCRYPTED_MEDIA)
-
-#include "Logging.h"
-#include <wtf/ByteOrder.h>
-
-namespace WebCore {
-
-namespace {
-
-static bool readUInt32(const uint8_t* buffer, size_t bufferSize, size_t& offset, uint32_t& value)
-{
-    ASSERT_ARG(offset, offset <= bufferSize);
-    if (bufferSize - offset < sizeof(value))
-        return false;
-
-    value = ntohl(*reinterpret_cast_ptr<const uint32_t*>(buffer + offset));
-    offset += sizeof(value);
-
-    return true;
-}
-
-static bool readUInt16(const uint8_t* buffer, size_t bufferSize, size_t& offset, uint16_t& value)
-{
-    ASSERT_ARG(offset, offset <= bufferSize);
-    if (bufferSize - offset < sizeof(value))
-        return false;
-
-    value = ntohs(*reinterpret_cast_ptr<const uint16_t*>(buffer + offset));
-    offset += sizeof(value);
-
-    return true;
-}
-
-} // namespace {}
-
-CDMProxyFactoryClearKey& CDMProxyFactoryClearKey::singleton()
-{
-    static NeverDestroyed<CDMProxyFactoryClearKey> s_factory;
-    return s_factory;
-}
-
-RefPtr<CDMProxy> CDMProxyFactoryClearKey::createCDMProxy(const String& keySystem)
-{
-    ASSERT_UNUSED(keySystem, supportsKeySystem(keySystem));
-    return adoptRef(new CDMProxyClearKey());
-}
-
-bool CDMProxyFactoryClearKey::supportsKeySystem(const String& keySystem)
-{
-    // `org.w3.clearkey` is the only supported key system.
-    return equalLettersIgnoringASCIICase(keySystem, "org.w3.clearkey");
-}
-
-CDMProxyClearKey::~CDMProxyClearKey()
-{
-    closeGCryptHandle();
-}
-
-bool CDMProxyClearKey::cencSetCounterVector(const cencDecryptContext& input)
-{
-    uint8_t ctr[ClearKey::AES128CTRBlockSizeInBytes];
-    if (input.ivSizeInBytes == 8) {
-        // ISO/IEC 23001-7:2016 Section 9.3
-
-        // When an 8-byte IV is indicated, the least significant 8
-        // bytes of the 16 byte IV (bytes 8 to 15) SHALL be set to
-        // zero.
-        memset(ctr + 8, 0, 8);
-        memcpy(ctr, input.iv, 8);
-    } else
-        memcpy(ctr, input.iv, ClearKey::IVSizeInBytes);
-
-    if (gcry_error_t cipherError = gcry_cipher_setctr(gCryptHandle(), ctr, ClearKey::IVSizeInBytes)) {
-#if !LOG_DISABLED
-        LOG(EME, "EME - CDMProxyClearKey - ERROR(gcry_cipher_setctr): %s", gpg_strerror(cipherError));
-#else
-        UNUSED_VARIABLE(cipherError);
-#endif
-        return false;
-    }
-
-    return true;
-}
-
-bool CDMProxyClearKey::cencSetDecryptionKey(cencDecryptContext& in)
-{
-    // FIXME: Unnecessary copy, can we avoid this while still exposing
-    // a non-GStreamer-specific DecryptInput API? These buffers are
-    // small (16 bytes), so not a huge deal, I guess.
-    Vector<uint8_t> keyIDVec { in.keyID, in.keyIDSizeInBytes };
-
-    auto keyData = getOrWaitForKeyValue(keyIDVec, WTFMove(in.cdmProxyDecryptionClient));
-    if (!keyData)
-        return false;
-
-    ASSERT(std::holds_alternative<Vector<uint8_t>>(keyData.value()));
-    auto& keyDataValue = std::get<Vector<uint8_t>>(keyData.value());
-
-    if (gcry_error_t cipherError = gcry_cipher_setkey(gCryptHandle(), keyDataValue.data(), keyDataValue.size())) {
-#if !LOG_DISABLED
-        LOG(EME, "EME - CDMProxyClearKey - ERROR(gcry_cipher_setkey): %s", gpg_strerror(cipherError));
-#else
-        UNUSED_VARIABLE(cipherError);
-#endif
-        return false;
-    }
-
-    return true;
-}
-
-bool CDMProxyClearKey::cencDecryptFullSample(cencDecryptContext& in)
-{
-    if (!in.encryptedBufferSizeInBytes)
-        return true;
-
-    LOG(EME, "EME - CDMProxyClearKey - full-sample decryption: %zu encrypted bytes", in.encryptedBufferSizeInBytes);
-
-    if (gcry_error_t cipherError = gcry_cipher_decrypt(gCryptHandle(), in.encryptedBuffer, in.encryptedBufferSizeInBytes, 0, 0)) {
-#if !LOG_DISABLED
-        LOG(EME, "EME - CDMProxyClearKey - ERROR(gcry_cipher_decrypt): %s", gpg_strerror(cipherError));
-#else
-        UNUSED_VARIABLE(cipherError);
-#endif
-        return false;
-    }
-
-    return true;
-}
-
-bool CDMProxyClearKey::cencDecryptSubsampled(cencDecryptContext& input)
-{
-    unsigned encryptedBufferByteOffset = 0;
-    size_t subSampleBufferByteOffset = 0;
-    unsigned subsampleIndex = 0;
-    while (encryptedBufferByteOffset < input.encryptedBufferSizeInBytes) {
-        uint16_t subsampleNumClearBytes = 0;
-        uint32_t subsampleNumEncryptedBytes = 0;
-
-        if (subsampleIndex < input.numSubsamples) {
-            if (!readUInt16(input.subsamplesBuffer, input.subsamplesBufferSizeInBytes, subSampleBufferByteOffset, subsampleNumClearBytes)) {
-                LOG(EME, "EME - CDMProxyClearKey - could not read number of clear bytes in subsample at index %u", subsampleIndex);
-                return false;
-            }
-            if (!readUInt32(input.subsamplesBuffer, input.subsamplesBufferSizeInBytes, subSampleBufferByteOffset, subsampleNumEncryptedBytes)) {
-                LOG(EME, "EME - CDMProxyClearKey - could not read number of encrypted bytes in subsample at index %u", subsampleIndex);
-                return false;
-            }
-            subsampleIndex++;
-        } else {
-            subsampleNumClearBytes = 0;
-            subsampleNumEncryptedBytes = input.encryptedBufferSizeInBytes - encryptedBufferByteOffset;
-        }
-
-        // FIXME: These are high-frequency messages, not sure if there's a better logging lib in WebCore.
-        LOG(EME, "EME - subsample index %u - %u bytes clear (%zu bytes left to decrypt)", subsampleIndex, subsampleNumClearBytes, input.encryptedBufferSizeInBytes - encryptedBufferByteOffset);
-
-        encryptedBufferByteOffset += subsampleNumClearBytes;
-
-        if (subsampleNumEncryptedBytes) {
-            LOG(EME, "EME - subsample index %u - %u bytes encrypted (%zu bytes left to decrypt)", subsampleIndex, subsampleNumEncryptedBytes, input.encryptedBufferSizeInBytes - encryptedBufferByteOffset);
-
-            if (gcry_error_t cipherError = gcry_cipher_decrypt(gCryptHandle(), input.encryptedBuffer + encryptedBufferByteOffset, subsampleNumEncryptedBytes, 0, 0)) {
-#if !LOG_DISABLED
-                LOG(EME, "EME - CDMProxyClearKey - ERROR(gcry_cipher_decrypt): %s", gpg_strerror(cipherError));
-#else
-                UNUSED_VARIABLE(cipherError);
-#endif
-                return false;
-            }
-
-            encryptedBufferByteOffset += subsampleNumEncryptedBytes;
-        }
-    }
-
-    return true;
-}
-
-bool CDMProxyClearKey::cencDecrypt(CDMProxyClearKey::cencDecryptContext& input)
-{
-    if (!cencSetCounterVector(input) || !cencSetDecryptionKey(input))
-        return false;
-
-    return input.isSubsampled() ? cencDecryptSubsampled(input) : cencDecryptFullSample(input);
-}
-
-void CDMProxyClearKey::closeGCryptHandle()
-{
-    if (m_gCryptHandle) {
-        gcry_cipher_close(*m_gCryptHandle);
-        m_gCryptHandle.reset();
-    }
-}
-
-gcry_cipher_hd_t& CDMProxyClearKey::gCryptHandle()
-{
-    if (!m_gCryptHandle) {
-        m_gCryptHandle.emplace();
-        if (gcry_error_t error = gcry_cipher_open(&m_gCryptHandle.value(), GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CTR, GCRY_CIPHER_SECURE)) {
-#if !LOG_DISABLED
-            LOG(EME, "EME - CDMProxyClearKey - ERROR(gcry_cipher_open): %s", gpg_strerror(error));
-#else
-            UNUSED_VARIABLE(error);
-#endif
-            RELEASE_ASSERT(false && "Should not get this far with a functional GCrypt!");
-        }
-    }
-
-    return *m_gCryptHandle;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(ENCRYPTED_MEDIA)

Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.h (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.h	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMProxyClearKey.h	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2020 Metrological Group B.V.
- * Copyright (C) 2020 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials provided
- *    with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(ENCRYPTED_MEDIA)
-
-#include "CDMClearKey.h"
-#include "CDMInstanceSession.h"
-#include "MediaPlayerPrivate.h"
-#include "SharedBuffer.h"
-#include <gcrypt.h>
-#include <wtf/Condition.h>
-#include <wtf/VectorHash.h>
-
-namespace WebCore {
-
-class CDMProxyFactoryClearKey final : public CDMProxyFactory {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    static CDMProxyFactoryClearKey& singleton();
-
-    ~CDMProxyFactoryClearKey() = default;
-
-private:
-    friend class NeverDestroyed<CDMProxyFactoryClearKey>;
-
-    CDMProxyFactoryClearKey() = default;
-    RefPtr<CDMProxy> createCDMProxy(const String&) final;
-    bool supportsKeySystem(const String&) final;
-};
-
-// This is the thread-safe API that decode threads should use to make use of a
-// platform CDM module.
-class CDMProxyClearKey final : public CDMProxy, public CanMakeWeakPtr<CDMProxyClearKey, WeakPtrFactoryInitialization::Eager> {
-public:
-    CDMProxyClearKey() = default;
-    virtual ~CDMProxyClearKey();
-
-    // FIXME: There's a lack of consistency between FragmentedSharedBuffers,
-    // Vector<char>'s and {uint8_t*,size_t} idioms for representing a chunk of
-    // bytes. Fix that somehow. Note FragmentedSharedBuffers are dangerous since
-    // they're not thread-safe and this class must maintain
-    // thread-safety, but maybe FragmentedSharedBuffer::DataSegment could be
-    // made to work, however that has zero helpers for dropping into
-    // iterator-aware / comparator-aware containers...
-    struct cencDecryptContext {
-        // FIXME: Enacapsulate these fields in non-copied types.
-        const uint8_t* keyID;
-        size_t keyIDSizeInBytes;
-
-        const uint8_t* iv;
-        size_t ivSizeInBytes;
-
-        uint8_t* encryptedBuffer;
-        size_t encryptedBufferSizeInBytes;
-
-        // FIXME: GStreamer-specific data layout.
-        // If we want to get rid of the specific data layout, we can parse it before
-        // assigning it here and maybe have a Vector<size_t> that is a series of
-        // clear/decrypted/clear/decrypted... Or maybe even a Vector<std::pair<size_t, size_t>>
-        // representing sequences of clear/decrypted sizes. That std::pair could even
-        // become a struct ClearDecryptedChunkSizesInBytes for example.
-        // https://bugs.webkit.org/show_bug.cgi?id=206730
-        const uint8_t* subsamplesBuffer;
-        size_t subsamplesBufferSizeInBytes;
-        size_t numSubsamples;
-        WeakPtr<CDMProxyDecryptionClient> cdmProxyDecryptionClient;
-
-        bool isSubsampled() const { return numSubsamples; }
-    };
-
-    // FIXME: Unconditional in-place decryption. What about SVP?
-    // FIXME: GStreamer-specific, in that the format of the subsample
-    // data is defined by whatever qtdemux decides to do with it.
-    bool cencDecrypt(cencDecryptContext&);
-
-private:
-    gcry_cipher_hd_t& gCryptHandle();
-
-    // FIXME: For now we only support AES in CTR mode, in the future
-    // we will surely have to support more protection schemes. Can we
-    // reuse some Crypto APIs in WebCore?
-    bool cencSetCounterVector(const cencDecryptContext&);
-    bool cencSetDecryptionKey(cencDecryptContext&);
-    bool cencDecryptFullSample(cencDecryptContext&);
-    bool cencDecryptSubsampled(cencDecryptContext&);
-
-    void closeGCryptHandle();
-
-    // FIXME: It would be nice to use something in WebCore for crypto...
-    std::optional<gcry_cipher_hd_t> m_gCryptHandle { std::nullopt };
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(ENCRYPTED_MEDIA)

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -123,15 +123,8 @@
         std::string emptyString;
         if (opencdm_is_type_supported(GStreamerEMEUtilities::s_WidevineKeySystem, emptyString.c_str()) == ERROR_NONE)
             supportedKeySystems.append(GStreamerEMEUtilities::s_WidevineKeySystem);
-        if (!supportedKeySystems.isEmpty()) {
-            unsigned thunderRank = isThunderRanked() ? 300 : 100;
-            gst_element_register(nullptr, "webkitthunder", GST_RANK_PRIMARY + thunderRank, WEBKIT_TYPE_MEDIA_THUNDER_DECRYPT);
-        }
-#ifndef NDEBUG
-        else if (isThunderRanked())
-            GST_WARNING("Thunder is up-ranked as preferred decryptor but Thunder is not supporting any encryption system. Is "
-                "Thunder running? Are the plugins built?");
-#endif
+        if (opencdm_is_type_supported(GStreamerEMEUtilities::s_ClearKeyKeySystem, emptyString.c_str()) == ERROR_NONE)
+            supportedKeySystems.append(GStreamerEMEUtilities::s_ClearKeyKeySystem);
         GST_DEBUG("%zu supported key systems", supportedKeySystems.size());
     };
     return supportedKeySystems;

Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,153 +0,0 @@
-/* GStreamer ClearKey common encryption decryptor
- *
- * Copyright (C) 2016 Metrological
- * Copyright (C) 2016 Igalia S.L
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
- * Boston, MA 02110-1335, USA.
- */
-
-#include "config.h"
-#include "WebKitClearKeyDecryptorGStreamer.h"
-
-#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
-
-#include "CDMClearKey.h"
-#include "CDMProxyClearKey.h"
-#include "GStreamerCommon.h"
-#include "GStreamerEMEUtilities.h"
-#include <gcrypt.h>
-#include <gst/base/gstbytereader.h>
-#include <wtf/RunLoop.h>
-#include <wtf/glib/WTFGType.h>
-
-using namespace WebCore;
-
-#define CLEARKEY_SIZE 16
-
-#define WEBKIT_MEDIA_CK_DECRYPT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_MEDIA_CK_DECRYPT, WebKitMediaClearKeyDecryptPrivate))
-struct _WebKitMediaClearKeyDecryptPrivate {
-    RefPtr<CDMProxyClearKey> cdmProxy;
-};
-
-static const char* protectionSystemId(WebKitMediaCommonEncryptionDecrypt*);
-static bool cdmProxyAttached(WebKitMediaCommonEncryptionDecrypt* self, const RefPtr<CDMProxy>&);
-static bool decrypt(WebKitMediaCommonEncryptionDecrypt*, GstBuffer* iv, GstBuffer* keyid, GstBuffer* sample, unsigned subSamplesCount, GstBuffer* subSamples);
-
-GST_DEBUG_CATEGORY_STATIC(webkit_media_clear_key_decrypt_debug_category);
-#define GST_CAT_DEFAULT webkit_media_clear_key_decrypt_debug_category
-
-static GstStaticPadTemplate sinkTemplate = GST_STATIC_PAD_TEMPLATE("sink",
-    GST_PAD_SINK,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS("application/x-cenc, original-media-type=(string)video/x-h264, protection-system=(string)" WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID "; "
-    "application/x-cenc, original-media-type=(string)audio/mpeg, protection-system=(string)" WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID";"
-    "application/x-webm-enc, original-media-type=(string)video/x-vp8;"
-    "application/x-webm-enc, original-media-type=(string)video/x-vp9;"));
-
-static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
-    GST_PAD_SRC,
-    GST_PAD_ALWAYS,
-    GST_STATIC_CAPS("video/x-h264; audio/mpeg; video/x-vp8; video/x-vp9"));
-
-#define webkit_media_clear_key_decrypt_parent_class parent_class
-WEBKIT_DEFINE_TYPE(WebKitMediaClearKeyDecrypt, webkit_media_clear_key_decrypt, WEBKIT_TYPE_MEDIA_CENC_DECRYPT)
-
-static void webkit_media_clear_key_decrypt_class_init(WebKitMediaClearKeyDecryptClass* klass)
-{
-    GstElementClass* elementClass = GST_ELEMENT_CLASS(klass);
-    gst_element_class_add_pad_template(elementClass, gst_static_pad_template_get(&sinkTemplate));
-    gst_element_class_add_pad_template(elementClass, gst_static_pad_template_get(&srcTemplate));
-
-    gst_element_class_set_static_metadata(elementClass,
-        "Decrypt content encrypted using ISOBMFF ClearKey Common Encryption",
-        GST_ELEMENT_FACTORY_KLASS_DECRYPTOR,
-        "Decrypts media that has been encrypted using ISOBMFF ClearKey Common Encryption.",
-        "Philippe Normand <[email protected]>");
-
-    GST_DEBUG_CATEGORY_INIT(webkit_media_clear_key_decrypt_debug_category,
-        "webkitclearkey", 0, "ClearKey decryptor");
-
-    WebKitMediaCommonEncryptionDecryptClass* cencClass = WEBKIT_MEDIA_CENC_DECRYPT_CLASS(klass);
-    cencClass->protectionSystemId = GST_DEBUG_FUNCPTR(protectionSystemId);
-    cencClass->cdmProxyAttached = GST_DEBUG_FUNCPTR(cdmProxyAttached);
-    cencClass->decrypt = GST_DEBUG_FUNCPTR(decrypt);
-}
-
-static const char* protectionSystemId(WebKitMediaCommonEncryptionDecrypt*)
-{
-    return GStreamerEMEUtilities::s_ClearKeyUUID;
-}
-
-static bool cdmProxyAttached(WebKitMediaCommonEncryptionDecrypt* self, const RefPtr<CDMProxy>& cdmProxy)
-{
-    WebKitMediaClearKeyDecryptPrivate* priv = WEBKIT_MEDIA_CK_DECRYPT_GET_PRIVATE(WEBKIT_MEDIA_CK_DECRYPT(self));
-    priv->cdmProxy = reinterpret_cast<CDMProxyClearKey*>(cdmProxy.get());
-    return priv->cdmProxy;
-}
-
-static bool decrypt(WebKitMediaCommonEncryptionDecrypt* self, GstBuffer* ivBuffer, GstBuffer* keyIDBuffer, GstBuffer* buffer, unsigned subsampleCount, GstBuffer* subsamplesBuffer)
-{
-    WebKitMediaClearKeyDecryptPrivate* priv = WEBKIT_MEDIA_CK_DECRYPT_GET_PRIVATE(WEBKIT_MEDIA_CK_DECRYPT(self));
-
-    if (!ivBuffer || !keyIDBuffer || !buffer) {
-        GST_ERROR_OBJECT(self, "invalid decrypt() parameter");
-        return false;
-    }
-
-    WebCore::GstMappedBuffer mappedIVBuffer(ivBuffer, GST_MAP_READ);
-    if (!mappedIVBuffer) {
-        GST_ERROR_OBJECT(self, "failed to map IV buffer");
-        return false;
-    }
-
-    WebCore::GstMappedBuffer mappedKeyIdBuffer(keyIDBuffer, GST_MAP_READ);
-    if (!mappedKeyIdBuffer) {
-        GST_ERROR_OBJECT(self, "Failed to map key id buffer");
-        return false;
-    }
-
-    WebCore::GstMappedBuffer mappedBuffer(buffer, GST_MAP_READWRITE);
-    if (!mappedBuffer) {
-        GST_ERROR_OBJECT(self, "Failed to map buffer");
-        return false;
-    }
-
-    CDMProxyClearKey::cencDecryptContext context = { };
-    context.keyID = mappedKeyIdBuffer.data();
-    context.keyIDSizeInBytes = mappedKeyIdBuffer.size();
-    context.iv = mappedIVBuffer.data();
-    context.ivSizeInBytes = mappedIVBuffer.size();
-    context.encryptedBuffer = mappedBuffer.data();
-    context.encryptedBufferSizeInBytes = mappedBuffer.size();
-    context.numSubsamples = subsampleCount;
-    if (!subsampleCount)
-        context.subsamplesBuffer = nullptr;
-    else {
-        ASSERT(subsamplesBuffer);
-        WebCore::GstMappedBuffer mappedSubsamplesBuffer(subsamplesBuffer, GST_MAP_READ);
-        if (!mappedSubsamplesBuffer) {
-            GST_ERROR_OBJECT(self, "Failed to map subsample buffer");
-            return false;
-        }
-        context.subsamplesBuffer = mappedSubsamplesBuffer.data();
-        context.subsamplesBufferSizeInBytes = mappedSubsamplesBuffer.size();
-    }
-    context.cdmProxyDecryptionClient = webKitMediaCommonEncryptionDecryptGetCDMProxyDecryptionClient(self);
-
-    return priv->cdmProxy->cencDecrypt(context);
-}
-
-#endif // ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)

Deleted: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h	2022-02-19 14:45:45 UTC (rev 290206)
@@ -1,54 +0,0 @@
-/* GStreamer ClearKey common encryption decryptor
- *
- * Copyright (C) 2016 Metrological
- * Copyright (C) 2016 Igalia S.L
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)
-
-#include "WebKitCommonEncryptionDecryptorGStreamer.h"
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_MEDIA_CK_DECRYPT          (webkit_media_clear_key_decrypt_get_type())
-#define WEBKIT_MEDIA_CK_DECRYPT(obj)          (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_MEDIA_CK_DECRYPT, WebKitMediaClearKeyDecrypt))
-#define WEBKIT_MEDIA_CK_DECRYPT_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_MEDIA_CK_DECRYPT, WebKitMediaClearKeyDecryptClass))
-#define WEBKIT_IS_MEDIA_CK_DECRYPT(obj)       (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_MEDIA_CK_DECRYPT))
-#define WEBKIT_IS_MEDIA_CK_DECRYPT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_MEDIA_CK_DECRYPT))
-
-typedef struct _WebKitMediaClearKeyDecrypt        WebKitMediaClearKeyDecrypt;
-typedef struct _WebKitMediaClearKeyDecryptClass   WebKitMediaClearKeyDecryptClass;
-typedef struct _WebKitMediaClearKeyDecryptPrivate WebKitMediaClearKeyDecryptPrivate;
-
-GType webkit_media_clear_key_decrypt_get_type(void);
-
-struct _WebKitMediaClearKeyDecrypt {
-    WebKitMediaCommonEncryptionDecrypt parent;
-
-    WebKitMediaClearKeyDecryptPrivate* priv;
-};
-
-struct _WebKitMediaClearKeyDecryptClass {
-    WebKitMediaCommonEncryptionDecryptClass parentClass;
-};
-
-G_END_DECLS
-
-#endif // ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -48,7 +48,7 @@
 
 static const char* cencEncryptionMediaTypes[] = { "video/mp4", "audio/mp4", "video/x-h264", "video/x-h265", "audio/mpeg", "video/x-vp9", nullptr };
 static const char** cbcsEncryptionMediaTypes = cencEncryptionMediaTypes;
-static const char* webmEncryptionMediaTypes[] = { "video/webm", "audio/webm", "video/x-vp9", "audio/x-opus", nullptr };
+static const char* webmEncryptionMediaTypes[] = { "video/webm", "audio/webm", "video/x-vp9", "audio/x-opus", "audio/x-vorbis", "video/x-vp8", nullptr };
 
 static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
     GST_PAD_SRC,
@@ -61,8 +61,8 @@
         "audio/mpeg; "
         "video/x-h264; "
         "video/x-h265; "
-        "video/x-vp9; "
-        "audio/x-opus; "));
+        "video/x-vp9; video/x-vp8;"
+        "audio/x-opus; audio/x-vorbis"));
 
 #define webkit_media_thunder_decrypt_parent_class parent_class
 WEBKIT_DEFINE_TYPE(WebKitMediaThunderDecrypt, webkit_media_thunder_decrypt, WEBKIT_TYPE_MEDIA_CENC_DECRYPT)
@@ -94,8 +94,7 @@
             cbcsEncryptionMediaTypes[i], nullptr));
     }
 
-    if (CDMFactoryThunder::singleton().supportsKeySystem(GStreamerEMEUtilities::s_WidevineKeySystem)) {
-        // WebM is Widevine only so no Widevine, no WebM decryption.
+    if (supportedKeySystems.contains(GStreamerEMEUtilities::s_WidevineKeySystem) || supportedKeySystems.contains(GStreamerEMEUtilities::s_ClearKeyKeySystem)) {
         for (int i = 0; webmEncryptionMediaTypes[i]; ++i) {
             gst_caps_append_structure(caps.get(), gst_structure_new("application/x-webm-enc", "original-media-type", G_TYPE_STRING,
                 webmEncryptionMediaTypes[i], nullptr));

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp (290205 => 290206)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp	2022-02-19 14:45:45 UTC (rev 290206)
@@ -722,8 +722,7 @@
         return true;
     }
     default:
-        GST_DEBUG_OBJECT(element, "Rejecting unsupported event: %" GST_PTR_FORMAT, event);
-        return false;
+        return GST_ELEMENT_CLASS(webkit_media_src_parent_class)->send_event(element, event);
     }
 }
 

Modified: trunk/Source/cmake/OptionsGTK.cmake (290205 => 290206)


--- trunk/Source/cmake/OptionsGTK.cmake	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/cmake/OptionsGTK.cmake	2022-02-19 14:45:45 UTC (rev 290206)
@@ -163,7 +163,7 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_CACHE_STALE_WHILE_REVALIDATE PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_OFFSCREEN_CANVAS PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_OFFSCREEN_CANVAS_IN_WORKERS PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THUNDER PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THUNDER PRIVATE ${ENABLE_DEVELOPER_MODE})
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PERIODIC_MEMORY_MONITOR PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_POINTER_LOCK PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ON)

Modified: trunk/Source/cmake/OptionsWPE.cmake (290205 => 290206)


--- trunk/Source/cmake/OptionsWPE.cmake	2022-02-19 14:05:53 UTC (rev 290205)
+++ trunk/Source/cmake/OptionsWPE.cmake	2022-02-19 14:45:45 UTC (rev 290206)
@@ -33,7 +33,6 @@
 # changing the value of the option.
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC ${ENABLE_EXPERIMENTAL_FEATURES})
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THUNDER PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
@@ -65,6 +64,7 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PERIODIC_MEMORY_MONITOR PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHAREABLE_RESOURCE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THUNDER PRIVATE ${ENABLE_DEVELOPER_MODE})
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_RTC PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBXR PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to