Title: [231088] trunk/Source/WebCore
Revision
231088
Author
[email protected]
Date
2018-04-27 00:27:45 -0700 (Fri, 27 Apr 2018)

Log Message

[EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application.
https://bugs.webkit.org/show_bug.cgi?id=181858

Patch by Yacine Bandou <[email protected]> on 2018-04-27
Reviewed by Xabier Rodriguez-Calvar.

Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key.
This message should be handled by the application in order to dispatch or send the key to the decryptor.
This patch is a preparation for the patch 181855.
With the patch 181855, the decryptor will be in the PlaybackPipeline instead of AppendPipeline, thus we can
get the DRM license or key before to instantiate or load the decryptor plugin in PlaybackPipeline.
When the decryptor plugin is instantiated or loaded, it should able to ask the application to resend
the DRM license or key by using this new message "decrypt-key-needed".

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (231087 => 231088)


--- trunk/Source/WebCore/ChangeLog	2018-04-27 06:22:00 UTC (rev 231087)
+++ trunk/Source/WebCore/ChangeLog	2018-04-27 07:27:45 UTC (rev 231088)
@@ -1,3 +1,27 @@
+2018-04-27  Yacine Bandou  <[email protected]>
+
+        [EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application.
+        https://bugs.webkit.org/show_bug.cgi?id=181858
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key.
+        This message should be handled by the application in order to dispatch or send the key to the decryptor.
+        This patch is a preparation for the patch 181855.
+        With the patch 181855, the decryptor will be in the PlaybackPipeline instead of AppendPipeline, thus we can
+        get the DRM license or key before to instantiate or load the decryptor plugin in PlaybackPipeline.
+        When the decryptor plugin is instantiated or loaded, it should able to ask the application to resend
+        the DRM license or key by using this new message "decrypt-key-needed".
+
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::dispatchCDMInstance):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+        * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
+        (webkitMediaCommonEncryptionDecryptTransformInPlace):
+
 2018-04-26  Justin Fan  <[email protected]>
 
         tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-04-27 06:22:00 UTC (rev 231087)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2018-04-27 07:27:45 UTC (rev 231088)
@@ -1245,6 +1245,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, "decrypt-key-needed")) {
+            GST_DEBUG("decrypt-key-needed message from %s", GST_MESSAGE_SRC_NAME(message));
+            MediaPlayerPrivateGStreamerBase::dispatchCDMInstance();
         }
 #endif
         else if (gst_structure_has_name(structure, "http-headers")) {

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-04-27 06:22:00 UTC (rev 231087)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2018-04-27 07:27:45 UTC (rev 231088)
@@ -1244,6 +1244,13 @@
     GST_TRACE("emitted decryption cipher key on pipeline, event handled %s, need to resend credentials %s", boolForPrinting(eventHandled), boolForPrinting(m_needToResendCredentials));
 }
 
+void MediaPlayerPrivateGStreamerBase::dispatchCDMInstance()
+{
+    // This function dispatches the CDMInstance in GStreamer playback pipeline.
+    if (m_cdmInstance)
+        m_player->attemptToDecryptWithInstance(const_cast<CDMInstance&>(*m_cdmInstance.get()));
+}
+
 void MediaPlayerPrivateGStreamerBase::handleProtectionEvent(GstEvent* event)
 {
     if (m_handledProtectionEvents.contains(GST_EVENT_SEQNUM(event))) {

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-04-27 06:22:00 UTC (rev 231087)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h	2018-04-27 07:27:45 UTC (rev 231088)
@@ -143,6 +143,7 @@
     void handleProtectionEvent(GstEvent*);
     void attemptToDecryptWithLocalInstance();
     void attemptToDecryptWithInstance(CDMInstance&) override;
+    void dispatchCDMInstance();
 #endif
 
     static bool supportsKeySystem(const String& keySystem, const String& mimeType);

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2018-04-27 06:22:00 UTC (rev 231087)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2018-04-27 07:27:45 UTC (rev 231088)
@@ -197,6 +197,9 @@
             GST_ERROR_OBJECT(self, "can't process key requests in less than PAUSED state");
             return GST_FLOW_NOT_SUPPORTED;
         }
+        // Send "decrypt-key-needed" message to the application in order to resend the key if it is available in the application.
+        gst_element_post_message(GST_ELEMENT(self), gst_message_new_element(GST_OBJECT(self), gst_structure_new_empty("decrypt-key-needed")));
+
         priv->condition.waitFor(priv->mutex, Seconds(5), [priv] {
             return priv->keyReceived;
         });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to