Modified: trunk/Source/WebCore/ChangeLog (231635 => 231636)
--- trunk/Source/WebCore/ChangeLog 2018-05-10 07:15:42 UTC (rev 231635)
+++ trunk/Source/WebCore/ChangeLog 2018-05-10 07:41:36 UTC (rev 231636)
@@ -1,5 +1,30 @@
2018-05-10 Yacine Bandou <[email protected]>
+ [EME][GStreamer] Add a handler for GStreamer protection event
+ https://bugs.webkit.org/show_bug.cgi?id=185245
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Qtdemux sends the protection event when encountered a new PSSH box (encrypted content).
+
+ The Decryptor is moved from AppendPipeline to PlaybackPipeline (see https://bugs.webkit.org/show_bug.cgi?id=181855),
+ thus the protection event is no longer handled because the Decryptor is not in the same pipeline as qtdemux.
+
+ AppendPipeline: httpsrc-->qtdemux-->appsink
+ PlaybackPipeline: appsrc-->parser--> decryptor-->decoder-->sink
+
+ This patch attaches a probe to the sink pad of the appsink in the appendPipeline in order to
+ catch and manage the protection event.
+
+ * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+ (WebCore::AppendPipeline::AppendPipeline):
+ (WebCore::AppendPipeline::~AppendPipeline):
+ (WebCore::appendPipelineAppsinkPadEventProbe):
+ * platform/graphics/gstreamer/mse/AppendPipeline.h:
+ (WebCore::AppendPipeline::playerPrivate):
+
+2018-05-10 Yacine Bandou <[email protected]>
+
[EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
https://bugs.webkit.org/show_bug.cgi?id=181855
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (231635 => 231636)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2018-05-10 07:15:42 UTC (rev 231635)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2018-05-10 07:41:36 UTC (rev 231636)
@@ -76,6 +76,11 @@
#if !LOG_DISABLED
static GstPadProbeReturn appendPipelinePadProbeDebugInformation(GstPad*, GstPadProbeInfo*, struct PadProbeInformation*);
#endif
+
+#if ENABLE(ENCRYPTED_MEDIA)
+static GstPadProbeReturn appendPipelineAppsinkPadEventProbe(GstPad*, GstPadProbeInfo*, struct PadProbeInformation*);
+#endif
+
static GstPadProbeReturn appendPipelineDemuxerBlackHolePadProbe(GstPad*, GstPadProbeInfo*, gpointer);
static GstFlowReturn appendPipelineAppsinkNewSample(GstElement*, AppendPipeline*);
static void appendPipelineAppsinkEOS(GstElement*, AppendPipeline*);
@@ -156,6 +161,12 @@
m_appsinkDataEnteringPadProbeInformation.probeId = gst_pad_add_probe(appsinkPad.get(), GST_PAD_PROBE_TYPE_BUFFER, reinterpret_cast<GstPadProbeCallback>(appendPipelinePadProbeDebugInformation), &m_appsinkDataEnteringPadProbeInformation, nullptr);
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+ m_appsinkPadEventProbeInformation.appendPipeline = this;
+ m_appsinkPadEventProbeInformation.description = "appsink event probe";
+ m_appsinkPadEventProbeInformation.probeId = gst_pad_add_probe(appsinkPad.get(), GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, reinterpret_cast<GstPadProbeCallback>(appendPipelineAppsinkPadEventProbe), &m_appsinkPadEventProbeInformation, nullptr);
+#endif
+
// These signals won't be connected outside of the lifetime of "this".
g_signal_connect(m_appsrc.get(), "need-data", G_CALLBACK(appendPipelineAppsrcNeedData), this);
g_signal_connect(m_demux.get(), "pad-added", G_CALLBACK(appendPipelineDemuxerPadAdded), this);
@@ -224,6 +235,9 @@
gst_pad_remove_probe(appsinkPad.get(), m_appsinkDataEnteringPadProbeInformation.probeId);
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+ gst_pad_remove_probe(appsinkPad.get(), m_appsinkPadEventProbeInformation.probeId);
+#endif
m_appsink = nullptr;
}
@@ -1071,6 +1085,27 @@
}
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+static GstPadProbeReturn appendPipelineAppsinkPadEventProbe(GstPad*, GstPadProbeInfo* info, struct PadProbeInformation *padProbeInformation)
+{
+ ASSERT(GST_PAD_PROBE_INFO_TYPE(info) & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM);
+ GstEvent* event = gst_pad_probe_info_get_event(info);
+ GST_DEBUG("Handling event %s on append pipeline appsinkPad", GST_EVENT_TYPE_NAME(event));
+ WebCore::AppendPipeline* appendPipeline = padProbeInformation->appendPipeline;
+
+ switch (GST_EVENT_TYPE(event)) {
+ case GST_EVENT_PROTECTION:
+ if (appendPipeline && appendPipeline->playerPrivate())
+ appendPipeline->playerPrivate()->handleProtectionEvent(event);
+ return GST_PAD_PROBE_DROP;
+ default:
+ break;
+ }
+
+ return GST_PAD_PROBE_OK;
+}
+#endif
+
static GstPadProbeReturn appendPipelineDemuxerBlackHolePadProbe(GstPad*, GstPadProbeInfo* info, gpointer)
{
ASSERT(GST_PAD_PROBE_INFO_TYPE(info) & GST_PAD_PROBE_TYPE_BUFFER);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h (231635 => 231636)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2018-05-10 07:15:42 UTC (rev 231635)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2018-05-10 07:41:36 UTC (rev 231636)
@@ -32,7 +32,7 @@
namespace WebCore {
-#if !LOG_DISABLED
+#if !LOG_DISABLED || ENABLE(ENCRYPTED_MEDIA)
struct PadProbeInformation {
AppendPipeline* appendPipeline;
const char* description;
@@ -75,6 +75,7 @@
GstElement* appsink() { return m_appsink.get(); }
GstCaps* demuxerSrcPadCaps() { return m_demuxerSrcPadCaps.get(); }
GstCaps* appsinkCaps() { return m_appsinkCaps.get(); }
+ MediaPlayerPrivateGStreamerMSE* playerPrivate() { return m_playerPrivate; }
RefPtr<WebCore::TrackPrivateBase> track() { return m_track; }
WebCore::MediaSourceStreamTypeGStreamer streamType() { return m_streamType; }
@@ -130,6 +131,9 @@
struct PadProbeInformation m_appsinkDataEnteringPadProbeInformation;
#endif
+#if ENABLE(ENCRYPTED_MEDIA)
+ struct PadProbeInformation m_appsinkPadEventProbeInformation;
+#endif
// Keeps track of the states of append processing, to avoid performing actions inappropriate for the current state
// (eg: processing more samples when the last one has been detected, etc.). See setAppendState() for valid
// transitions.