Title: [220862] trunk/Source/WebCore
Revision
220862
Author
[email protected]
Date
2017-08-17 09:40:56 -0700 (Thu, 17 Aug 2017)

Log Message

[GStreamer] AppendPipeline: support dispatch of decryption-specific GstStructure into the pipeline
https://bugs.webkit.org/show_bug.cgi?id=175668

Reviewed by Xabier Rodriguez-Calvar.

Add the AppendPipeline::dispatchDecryptionStructure() method. Callers can
pass in a GstStructure object that contains all the information the
decryption elements in the pipeline will require to properly decrypt the
content. In case the decryptor element isn't available yet, the
GstStructure is stored and dispatched when that element becomes available.

The dispatch itself simply creates a new custom GstEvent that adopts the
given GstStructure object, sends that into the pipeline element, and
shifts the state to 'ongoing'.

* platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
(WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
(WebCore::AppendPipeline::dispatchDecryptionStructure):
* platform/graphics/gstreamer/mse/AppendPipeline.h: Remove a redundant private: label.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220861 => 220862)


--- trunk/Source/WebCore/ChangeLog	2017-08-17 16:37:28 UTC (rev 220861)
+++ trunk/Source/WebCore/ChangeLog	2017-08-17 16:40:56 UTC (rev 220862)
@@ -1,5 +1,28 @@
 2017-08-17  Zan Dobersek  <[email protected]>
 
+        [GStreamer] AppendPipeline: support dispatch of decryption-specific GstStructure into the pipeline
+        https://bugs.webkit.org/show_bug.cgi?id=175668
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Add the AppendPipeline::dispatchDecryptionStructure() method. Callers can
+        pass in a GstStructure object that contains all the information the
+        decryption elements in the pipeline will require to properly decrypt the
+        content. In case the decryptor element isn't available yet, the
+        GstStructure is stored and dispatched when that element becomes available.
+
+        The dispatch itself simply creates a new custom GstEvent that adopts the
+        given GstStructure object, sends that into the pipeline element, and
+        shifts the state to 'ongoing'.
+
+        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+        (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
+        (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
+        (WebCore::AppendPipeline::dispatchDecryptionStructure):
+        * platform/graphics/gstreamer/mse/AppendPipeline.h: Remove a redundant private: label.
+
+2017-08-17  Zan Dobersek  <[email protected]>
+
         [GStreamer] GstStructure shouldn't be handled through GRefPtr
         https://bugs.webkit.org/show_bug.cgi?id=175673
 

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp	2017-08-17 16:37:28 UTC (rev 220861)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp	2017-08-17 16:40:56 UTC (rev 220862)
@@ -942,6 +942,9 @@
 
             gst_element_sync_state_with_parent(m_appsink.get());
             gst_element_sync_state_with_parent(m_decryptor.get());
+
+            if (m_pendingDecryptionStructure)
+                dispatchPendingDecryptionStructure();
         } else {
 #endif
             gst_pad_link(demuxerSrcPad, appsinkSinkPad.get());
@@ -1047,6 +1050,35 @@
         gst_element_unlink(m_demux.get(), m_appsink.get());
 }
 
+#if ENABLE(ENCRYPTED_MEDIA)
+void AppendPipeline::dispatchPendingDecryptionStructure()
+{
+    ASSERT(m_decryptor);
+    ASSERT(m_pendingDecryptionStructure);
+    ASSERT(m_appendState == KeyNegotiation);
+    GST_TRACE("dispatching key to append pipeline %p", this);
+
+    // Release the m_pendingDecryptionStructure object since
+    // gst_event_new_custom() takes over ownership of it.
+    gst_element_send_event(m_pipeline.get(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, m_pendingDecryptionStructure.release()));
+
+    setAppendState(AppendState::Ongoing);
+}
+
+void AppendPipeline::dispatchDecryptionStructure(GUniquePtr<GstStructure>&& structure)
+{
+    if (m_appendState == AppendState::KeyNegotiation) {
+        GST_TRACE("append pipeline %p in key negotiation", this);
+        m_pendingDecryptionStructure = WTFMove(structure);
+        if (m_decryptor)
+            dispatchPendingDecryptionStructure();
+        else
+            GST_TRACE("no decryptor yet, waiting for it");
+    } else
+        GST_TRACE("append pipeline %p not in key negotiation", this);
+}
+#endif
+
 static void appendPipelineAppsinkCapsChanged(GObject* appsinkPad, GParamSpec*, AppendPipeline* appendPipeline)
 {
     GstStructure* structure = gst_structure_new_empty("appsink-caps-changed");

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h	2017-08-17 16:37:28 UTC (rev 220861)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h	2017-08-17 16:40:56 UTC (rev 220862)
@@ -23,6 +23,7 @@
 #if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE)
 
 #include "GRefPtrGStreamer.h"
+#include "GUniquePtrGStreamer.h"
 #include "MediaPlayerPrivateGStreamerMSE.h"
 #include "MediaSourceClientGStreamerMSE.h"
 #include "SourceBufferPrivateGStreamer.h"
@@ -56,6 +57,9 @@
 
     GstFlowReturn handleNewAppsinkSample(GstElement*);
     GstFlowReturn pushNewBuffer(GstBuffer*);
+#if ENABLE(ENCRYPTED_MEDIA)
+    void dispatchDecryptionStructure(GUniquePtr<GstStructure>&&);
+#endif
 
     // Takes ownership of caps.
     void parseDemuxerSrcPadCaps(GstCaps*);
@@ -91,8 +95,10 @@
     void handleAppsrcNeedDataReceived();
     void removeAppsrcDataLeavingProbe();
     void setAppsrcDataLeavingProbe();
+#if ENABLE(ENCRYPTED_MEDIA)
+    void dispatchPendingDecryptionStructure();
+#endif
 
-private:
     Ref<MediaSourceClientGStreamerMSE> m_mediaSourceClient;
     Ref<SourceBufferPrivateGStreamer> m_sourceBufferPrivate;
     MediaPlayerPrivateGStreamerMSE* m_playerPrivate;
@@ -146,6 +152,9 @@
     RefPtr<WebCore::TrackPrivateBase> m_track;
 
     GRefPtr<GstBuffer> m_pendingBuffer;
+#if ENABLE(ENCRYPTED_MEDIA)
+    GUniquePtr<GstStructure> m_pendingDecryptionStructure;
+#endif
 };
 
 } // namespace WebCore.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to