Modified: trunk/Source/WebCore/ChangeLog (212359 => 212360)
--- trunk/Source/WebCore/ChangeLog 2017-02-15 14:33:41 UTC (rev 212359)
+++ trunk/Source/WebCore/ChangeLog 2017-02-15 15:14:13 UTC (rev 212360)
@@ -1,3 +1,22 @@
+2017-02-15 Xabier Rodriguez Calvar <[email protected]>
+
+ [GStreamer][MSE][EME] Handle protection event also at decryptor level
+ https://bugs.webkit.org/show_bug.cgi?id=168316
+
+ Reviewed by Žan Doberšek.
+
+ So far in MSE pipeline we were handling the encryption events
+ only when they arrived at the demuxer but this won't work in any
+ kind of key renegotiation as the event will never arrive. Now we
+ connect to the element messages, check for the drm id and send it
+ to the private player for processing.
+
+ * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
+ (WebCore::appendPipelineElementMessageCallback):
+ (WebCore::AppendPipeline::AppendPipeline):
+ (WebCore::AppendPipeline::handleElementMessage):
+ * platform/graphics/gstreamer/mse/AppendPipeline.h:
+
2017-02-15 Zan Dobersek <[email protected]>
[EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp (212359 => 212360)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2017-02-15 14:33:41 UTC (rev 212359)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp 2017-02-15 15:14:13 UTC (rev 212360)
@@ -93,6 +93,13 @@
appendPipeline->handleApplicationMessage(message);
}
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+static void appendPipelineElementMessageCallback(GstBus*, GstMessage* message, AppendPipeline* appendPipeline)
+{
+ appendPipeline->handleElementMessage(message);
+}
+#endif
+
AppendPipeline::AppendPipeline(Ref<MediaSourceClientGStreamerMSE> mediaSourceClient, Ref<SourceBufferPrivateGStreamer> sourceBufferPrivate, MediaPlayerPrivateGStreamerMSE& playerPrivate)
: m_mediaSourceClient(mediaSourceClient.get())
, m_sourceBufferPrivate(sourceBufferPrivate.get())
@@ -119,6 +126,9 @@
g_signal_connect(m_bus.get(), "sync-message::need-context", G_CALLBACK(appendPipelineNeedContextMessageCallback), this);
g_signal_connect(m_bus.get(), "message::application", G_CALLBACK(appendPipelineApplicationMessageCallback), this);
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+ g_signal_connect(m_bus.get(), "message::element", G_CALLBACK(appendPipelineElementMessageCallback), this);
+#endif
// We assign the created instances here instead of adoptRef() because gst_bin_add_many()
// below will already take the initial reference and we need an additional one for us.
@@ -284,6 +294,24 @@
m_playerPrivate->handleSyncMessage(message);
}
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+void AppendPipeline::handleElementMessage(GstMessage* message)
+{
+ ASSERT(WTF::isMainThread());
+
+ const GstStructure* structure = gst_message_get_structure(message);
+ GST_TRACE("%s message from %s", gst_structure_get_name(structure), GST_MESSAGE_SRC_NAME(message));
+ if (m_playerPrivate && gst_structure_has_name(structure, "drm-key-needed")) {
+ setAppendState(AppendPipeline::AppendState::KeyNegotiation);
+
+ GST_DEBUG("sending drm-key-needed message from %s to the player", GST_MESSAGE_SRC_NAME(message));
+ GRefPtr<GstEvent> event;
+ gst_structure_get(structure, "event", GST_TYPE_EVENT, &event.outPtr(), nullptr);
+ m_playerPrivate->handleProtectionEvent(event.get());
+ }
+}
+#endif
+
void AppendPipeline::handleApplicationMessage(GstMessage* message)
{
ASSERT(WTF::isMainThread());
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h (212359 => 212360)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2017-02-15 14:33:41 UTC (rev 212359)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h 2017-02-15 15:14:13 UTC (rev 212360)
@@ -49,6 +49,9 @@
void handleNeedContextSyncMessage(GstMessage*);
void handleApplicationMessage(GstMessage*);
+#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+ void handleElementMessage(GstMessage*);
+#endif
gint id();
AppendState appendState() { return m_appendState; }