Title: [210132] trunk/Source/WebCore
Revision
210132
Author
[email protected]
Date
2016-12-23 01:15:07 -0800 (Fri, 23 Dec 2016)

Log Message

[EME][GStreamer] Enable various code paths for ENCRYPTED_MEDIA
https://bugs.webkit.org/show_bug.cgi?id=166054

Reviewed by Xabier Rodriguez-Calvar.

Add ENABLE_ENCRYPTED_MEDIA build guards in various places in GStreamer
code to enable decryption-related GStreamer elements and the proper
decryptor handling in AppendPipeline.

* platform/GStreamer.cmake:
* platform/graphics/gstreamer/GStreamerUtilities.cpp:
* platform/graphics/gstreamer/GStreamerUtilities.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::registerWebKitGStreamerElements):
(WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
Only call needKey() if LEGACY_ENCRYPTED_MEDIA is enabled, since this is
the way the legacy EME system expects to be notified of key necessity.
It's very likely ENCRYPTED_MEDIA will do this differently.
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
(WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
* platform/graphics/gstreamer/mse/AppendPipeline.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (210131 => 210132)


--- trunk/Source/WebCore/ChangeLog	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/ChangeLog	2016-12-23 09:15:07 UTC (rev 210132)
@@ -1,3 +1,33 @@
+2016-12-23  Zan Dobersek  <[email protected]>
+
+        [EME][GStreamer] Enable various code paths for ENCRYPTED_MEDIA
+        https://bugs.webkit.org/show_bug.cgi?id=166054
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Add ENABLE_ENCRYPTED_MEDIA build guards in various places in GStreamer
+        code to enable decryption-related GStreamer elements and the proper
+        decryptor handling in AppendPipeline.
+
+        * platform/GStreamer.cmake:
+        * platform/graphics/gstreamer/GStreamerUtilities.cpp:
+        * platform/graphics/gstreamer/GStreamerUtilities.h:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::registerWebKitGStreamerElements):
+        (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
+        Only call needKey() if LEGACY_ENCRYPTED_MEDIA is enabled, since this is
+        the way the legacy EME system expects to be notified of key necessity.
+        It's very likely ENCRYPTED_MEDIA will do this differently.
+        * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
+        * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
+        * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
+        * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
+        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+        (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
+        (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
+        (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
+        * platform/graphics/gstreamer/mse/AppendPipeline.h:
+
 2016-12-23  Ryosuke Niwa  <[email protected]>
 
         Eliminate the use of lastChild in TextIterator

Modified: trunk/Source/WebCore/platform/GStreamer.cmake (210131 => 210132)


--- trunk/Source/WebCore/platform/GStreamer.cmake	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/GStreamer.cmake	2016-12-23 09:15:07 UTC (rev 210132)
@@ -130,7 +130,7 @@
     )
 endif ()
 
-if (ENABLE_LEGACY_ENCRYPTED_MEDIA)
+if (ENABLE_LEGACY_ENCRYPTED_MEDIA OR ENABLE_ENCRYPTED_MEDIA)
     list(APPEND WebCore_INCLUDE_DIRECTORIES
         ${LIBGCRYPT_INCLUDE_DIRS}
     )

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp (210131 => 210132)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2016-12-23 09:15:07 UTC (rev 210132)
@@ -197,7 +197,7 @@
     return result;
 }
 
-#if GST_CHECK_VERSION(1, 5, 3) && ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if GST_CHECK_VERSION(1, 5, 3) && (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA))
 GstElement* createGstDecryptor(const gchar* protectionSystem)
 {
     GstElement* decryptor = nullptr;

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h (210131 => 210132)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h	2016-12-23 09:15:07 UTC (rev 210132)
@@ -65,7 +65,7 @@
 GstClockTime toGstClockTime(float time);
 bool gstRegistryHasElementForMediaType(GList* elementFactories, const char* capsString);
 
-#if GST_CHECK_VERSION(1, 5, 3) && ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if GST_CHECK_VERSION(1, 5, 3) && (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA))
 GstElement* createGstDecryptor(const gchar* protectionSystem);
 #endif
 }

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2016-12-23 09:15:07 UTC (rev 210132)
@@ -90,13 +90,15 @@
 #include <cairo-gl.h>
 #endif
 
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)
+#include "WebKitClearKeyDecryptorGStreamer.h"
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
 #include "UUID.h"
-#include "WebKitClearKeyDecryptorGStreamer.h"
 #include <runtime/JSCInlines.h>
 #include <runtime/TypedArrayInlines.h>
 #include <runtime/Uint8Array.h>
 #endif
+#endif
 
 GST_DEBUG_CATEGORY(webkit_media_player_debug);
 #define GST_CAT_DEFAULT webkit_media_player_debug
@@ -107,7 +109,7 @@
 
 void registerWebKitGStreamerElements()
 {
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)
     if (!webkitGstCheckVersion(1, 6, 1))
         return;
 
@@ -258,7 +260,7 @@
     UNUSED_PARAM(message);
 #endif // USE(GSTREAMER_GL)
 
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)
     if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) {
         const GstStructure* structure = gst_message_get_structure(message);
         if (gst_structure_has_name(structure, "drm-key-needed")) {
@@ -279,10 +281,13 @@
             if (UNLIKELY(!valid || !gst_buffer_map(data.get(), &mapInfo, GST_MAP_READ)))
                 return false;
 
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
             GST_DEBUG("scheduling keyNeeded event");
             // FIXME: Provide a somehow valid sessionId.
             RefPtr<Uint8Array> initData = Uint8Array::create(reinterpret_cast<const unsigned char *>(mapInfo.data), mapInfo.size);
             needKey(initData);
+#endif
+
             gst_buffer_unmap(data.get(), &mapInfo);
             return true;
         }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp (210131 => 210132)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp	2016-12-23 09:15:07 UTC (rev 210132)
@@ -22,7 +22,7 @@
 #include "config.h"
 #include "WebKitClearKeyDecryptorGStreamer.h"
 
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#if (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)
 
 #include "GRefPtrGStreamer.h"
 #include <gcrypt.h>
@@ -269,4 +269,4 @@
     gcry_cipher_close(priv->handle);
 }
 
-#endif // ENABLE(LEGACY_ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#endif // (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h (210131 => 210132)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h	2016-12-23 09:15:07 UTC (rev 210132)
@@ -21,7 +21,7 @@
 
 #pragma once
 
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#if (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)
 
 #include "WebKitCommonEncryptionDecryptorGStreamer.h"
 
@@ -51,4 +51,4 @@
 
 G_END_DECLS
 
-#endif // ENABLE(LEGACY_ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#endif // (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp	2016-12-23 09:15:07 UTC (rev 210132)
@@ -23,7 +23,7 @@
 #include "config.h"
 #include "WebKitCommonEncryptionDecryptorGStreamer.h"
 
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#if (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)
 
 #include "GRefPtrGStreamer.h"
 #include <wtf/Condition.h>
@@ -370,5 +370,4 @@
 {
 }
 
-
-#endif // ENABLE(LEGACY_ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#endif // (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h (210131 => 210132)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h	2016-12-23 09:15:07 UTC (rev 210132)
@@ -22,7 +22,7 @@
 
 #pragma once
 
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA) && USE(GSTREAMER)
+#if (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)
 
 #include <gst/base/gstbasetransform.h>
 #include <gst/gst.h>
@@ -62,4 +62,4 @@
 
 G_END_DECLS
 
-#endif
+#endif // (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (210131 => 210132)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp	2016-12-23 09:15:07 UTC (rev 210132)
@@ -519,7 +519,7 @@
     GstStructure* structure = gst_caps_get_structure(m_demuxerSrcPadCaps.get(), 0);
     bool sizeConfigured = false;
 
-#if GST_CHECK_VERSION(1, 5, 3) && ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if GST_CHECK_VERSION(1, 5, 3) && (ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA))
     if (gst_structure_has_name(structure, "application/x-cenc")) {
         // Any previous decryptor should have been removed from the pipeline by disconnectFromAppSinkFromStreamingThread()
         ASSERT(!m_decryptor);
@@ -925,7 +925,7 @@
         if (!parent)
             gst_bin_add(GST_BIN(m_pipeline.get()), m_appsink.get());
 
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)
         if (m_decryptor) {
             gst_object_ref(m_decryptor.get());
             gst_bin_add(GST_BIN(m_pipeline.get()), m_decryptor.get());
@@ -942,7 +942,7 @@
 #endif
             gst_pad_link(demuxerSrcPad, appsinkSinkPad.get());
             gst_element_sync_state_with_parent(m_appsink.get());
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)
         }
 #endif
         gst_element_set_state(m_pipeline.get(), GST_STATE_PAUSED);
@@ -1032,7 +1032,7 @@
 
     GST_DEBUG("Disconnecting appsink");
 
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)
     if (m_decryptor) {
         gst_element_unlink(m_decryptor.get(), m_appsink.get());
         gst_element_unlink(m_demux.get(), m_decryptor.get());

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h (210131 => 210132)


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h	2016-12-23 09:11:32 UTC (rev 210131)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h	2016-12-23 09:15:07 UTC (rev 210132)
@@ -108,7 +108,7 @@
     GRefPtr<GstBus> m_bus;
     GRefPtr<GstElement> m_appsrc;
     GRefPtr<GstElement> m_demux;
-#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA)
     GRefPtr<GstElement> m_decryptor;
 #endif
     // The demuxer has one src stream only, so only one appsink is needed and linked to it.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to