Title: [236104] trunk
Revision
236104
Author
[email protected]
Date
2018-09-18 02:14:31 -0700 (Tue, 18 Sep 2018)

Log Message

[EME][GStreamer] The current EME implementation doesn't support the waitingforkey event
https://bugs.webkit.org/show_bug.cgi?id=185590

Reviewed by Philippe Normand.

Source/WebCore:

When decryptors are blocked waiting for the key, instruct the
player to run the Wait for key algorithm. As per spec, if we run
out of blocks pending to decrypt because we don't have the key, we
request running the algorithm again.

Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https.html.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
(WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(webkitMediaCommonEncryptionDecryptTransformInPlace):
(webkitMediaCommonEncryptionDecryptSinkEventHandler):

LayoutTests:

Updated status of
imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https
and expectations.

* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (236103 => 236104)


--- trunk/LayoutTests/ChangeLog	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/LayoutTests/ChangeLog	2018-09-18 09:14:31 UTC (rev 236104)
@@ -1,3 +1,17 @@
+2018-09-18  Xabier Rodriguez Calvar  <[email protected]>
+
+        [EME][GStreamer] The current EME implementation doesn't support the waitingforkey event
+        https://bugs.webkit.org/show_bug.cgi?id=185590
+
+        Reviewed by Philippe Normand.
+
+        Updated status of
+        imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https
+        and expectations.
+
+        * platform/wpe/TestExpectations:
+        * platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https-expected.txt:
+
 2018-09-17  Ryan Haddad  <[email protected]>
 
         Layout Test legacy-animation-engine/animations/play-state-in-shorthand.html is a flaky failure

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (236103 => 236104)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2018-09-18 09:14:31 UTC (rev 236104)
@@ -1211,10 +1211,9 @@
 media/encrypted-media/encrypted-media-v2-syntax.html [ Skip ]
 
 #"waitingforkey" event is not supported yet
-webkit.org/b/185590 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential-readyState.https.html [ Failure ]
-webkit.org/b/185590 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential.https.html [ Failure ]
-webkit.org/b/185590 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https.html [ Failure ]
-webkit.org/b/185590 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https.html [ Failure ]
+webkit.org/b/189618 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential-readyState.https.html [ Failure ]
+webkit.org/b/189618 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential.https.html [ Failure ]
+webkit.org/b/189619 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https.html [ Failure ]
 
 webkit.org/b/185594 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted.https.html [ Failure ]
 

Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https-expected.txt (236103 => 236104)


--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https-expected.txt	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https-expected.txt	2018-09-18 09:14:31 UTC (rev 236104)
@@ -1,3 +1,3 @@
 
-Pass	org.w3.clearkey, successful playback, temporary, mp4, waitingforkey event, 1 key 
+PASS org.w3.clearkey, successful playback, temporary, mp4, waitingforkey event, 1 key 
 

Modified: trunk/Source/WebCore/ChangeLog (236103 => 236104)


--- trunk/Source/WebCore/ChangeLog	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/Source/WebCore/ChangeLog	2018-09-18 09:14:31 UTC (rev 236104)
@@ -1,3 +1,27 @@
+2018-09-18  Xabier Rodriguez Calvar  <[email protected]>
+
+        [EME][GStreamer] The current EME implementation doesn't support the waitingforkey event
+        https://bugs.webkit.org/show_bug.cgi?id=185590
+
+        Reviewed by Philippe Normand.
+
+        When decryptors are blocked waiting for the key, instruct the
+        player to run the Wait for key algorithm. As per spec, if we run
+        out of blocks pending to decrypt because we don't have the key, we
+        request running the algorithm again.
+
+        Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https.html.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
+        (WebCore::MediaPlayerPrivateGStreamerBase::reportWaitingForKey):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+        * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
+        (webkitMediaCommonEncryptionDecryptTransformInPlace):
+        (webkitMediaCommonEncryptionDecryptSinkEventHandler):
+
 2018-09-12  Ryosuke Niwa  <[email protected]>
 
         Update composedPath to match the latest spec

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-09-18 09:14:31 UTC (rev 236104)
@@ -1308,6 +1308,9 @@
             GRefPtr<GstEvent> event;
             gst_structure_get(structure, "event", GST_TYPE_EVENT, &event.outPtr(), nullptr);
             handleProtectionEvent(event.get());
+        } else if (gst_structure_has_name(structure, "drm-waiting-for-key")) {
+            GST_DEBUG("drm-waiting-for-key message from %s", GST_MESSAGE_SRC_NAME(message));
+            reportWaitingForKey();
         } else if (gst_structure_has_name(structure, "drm-cdm-instance-needed")) {
             GST_DEBUG("drm-cdm-instance-needed message from %s", GST_MESSAGE_SRC_NAME(message));
             dispatchCDMInstance();

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (236103 => 236104)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-09-18 09:14:31 UTC (rev 236104)
@@ -1260,7 +1260,6 @@
 #if ENABLE(ENCRYPTED_MEDIA)
 void MediaPlayerPrivateGStreamerBase::initializationDataEncountered(GstEvent* event)
 {
-    // FIXME: Inform that we are waiting for a key.
     const char* eventKeySystemUUID = nullptr;
     GstBuffer* data = ""
     gst_event_parse_protection(event, &eventKeySystemUUID, &data, nullptr);
@@ -1350,6 +1349,12 @@
     }
     initializationDataEncountered(event);
 }
+
+void MediaPlayerPrivateGStreamerBase::reportWaitingForKey()
+{
+    GST_TRACE("waiting for key");
+    m_player->waitingForKey();
+}
 #endif
 
 bool MediaPlayerPrivateGStreamerBase::supportsKeySystem(const String& keySystem, const String& mimeType)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (236103 => 236104)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-09-18 09:14:31 UTC (rev 236104)
@@ -152,6 +152,7 @@
     void attemptToDecryptWithInstance(CDMInstance&) override;
     void dispatchCDMInstance();
     void initializationDataEncountered(GstEvent*);
+    void reportWaitingForKey();
 #endif
 
     static bool supportsKeySystem(const String& keySystem, const String& mimeType);

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp (236103 => 236104)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2018-09-18 07:47:35 UTC (rev 236103)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2018-09-18 09:14:31 UTC (rev 236104)
@@ -34,6 +34,7 @@
     GRefPtr<GstEvent> protectionEvent;
 
     bool keyReceived;
+    bool waitingForKey { false };
     Lock mutex;
     Condition condition;
 };
@@ -197,8 +198,10 @@
             GST_ERROR_OBJECT(self, "can't process key requests in less than PAUSED state");
             return GST_FLOW_NOT_SUPPORTED;
         }
-        // Send "drm-cdm-instance-needed" message to the player to resend the CDMInstance if available.
+        // Send "drm-cdm-instance-needed" message to the player to resend the CDMInstance if available and inform we are waiting for key.
         gst_element_post_message(GST_ELEMENT(self), gst_message_new_element(GST_OBJECT(self), gst_structure_new_empty("drm-cdm-instance-needed")));
+        priv->waitingForKey = true;
+        gst_element_post_message(GST_ELEMENT(self), gst_message_new_element(GST_OBJECT(self), gst_structure_new_empty("drm-waiting-for-key")));
 
         priv->condition.waitFor(priv->mutex, Seconds(5), [priv] {
             return priv->keyReceived;
@@ -303,7 +306,11 @@
         if (klass->handleKeyResponse(self, event)) {
             GST_DEBUG_OBJECT(self, "key received");
             priv->keyReceived = true;
+            priv->waitingForKey = false;
             priv->condition.notifyOne();
+        } else if (priv->waitingForKey) {
+            GST_DEBUG_OBJECT(self, "still waiting for key, reposting");
+            gst_element_post_message(GST_ELEMENT(self), gst_message_new_element(GST_OBJECT(self), gst_structure_new_empty("drm-waiting-for-key")));
         }
 
         gst_event_unref(event);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to