WebKit Bugzilla
Attachment 339550 Details for
Bug 185245
: [EME][GStreamer] Add a handler for GStreamer protection event
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185245-20180504182036.patch (text/plain), 9.21 KB, created by
Yacine Bandou
on 2018-05-04 09:20:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yacine Bandou
Created:
2018-05-04 09:20:36 PDT
Size:
9.21 KB
patch
obsolete
>Subversion Revision: 231044 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 1b9f5d7dd867008172d07976e077d402426554ff..79cd458d309b8c1f59ac675594308e46d23ad22c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,30 @@ >+2018-05-04 Yacine Bandou <yacine.bandou_ext@softathome.com> >+ >+ [EME][GStreamer] Add a handler for GStreamer protection event >+ https://bugs.webkit.org/show_bug.cgi?id=185245 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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/MediaPlayerPrivateGStreamerBase.cpp: >+ (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent): >+ * 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-03 Yacine Bandou <yacine.bandou_ext@softathome.com> > > [EME][GStreamer] Crash when the mediaKeys created before loading the media in debug conf >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >index 34388c34849393ddfd6b721076d5da776517cd65..5a2bc05f67e9aba29ed610802e5472fd1fe7d51d 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >@@ -1255,20 +1255,37 @@ void MediaPlayerPrivateGStreamerBase::dispatchCDMInstance() > > void MediaPlayerPrivateGStreamerBase::handleProtectionEvent(GstEvent* event) > { >+ const gchar* eventKeySystemId = nullptr; >+ GstBuffer* data = nullptr; >+ Vector<uint8_t> concatenatedInitDataChunks; >+ > if (m_handledProtectionEvents.contains(GST_EVENT_SEQNUM(event))) { > GST_DEBUG_OBJECT(pipeline(), "event %u already handled", GST_EVENT_SEQNUM(event)); >- m_handledProtectionEvents.remove(GST_EVENT_SEQNUM(event)); >- if (m_needToResendCredentials) { >- GST_DEBUG_OBJECT(pipeline(), "resending credentials"); >- attemptToDecryptWithLocalInstance(); >- } > return; > } > >- const gchar* eventKeySystemId = nullptr; >- gst_event_parse_protection(event, &eventKeySystemId, nullptr, nullptr); >- GST_WARNING("FIXME: unhandled protection event for %s", eventKeySystemId); >- ASSERT_NOT_REACHED(); >+ gst_event_parse_protection(event, &eventKeySystemId, &data, nullptr); >+ if (m_cdmInstance && strcmp(GStreamerEMEUtilities::keySystemToUuid(m_cdmInstance->keySystem()), eventKeySystemId)) >+ return; >+ >+ GstMapInfo mapInfo; >+ if (!gst_buffer_map(data, &mapInfo, GST_MAP_READ)) { >+ GST_WARNING("cannot map %s protection data", eventKeySystemId); >+ return; >+ } >+ >+ GST_DEBUG("scheduling Protection event for %s with init data size of %u", eventKeySystemId, mapInfo.size); >+ GST_MEMDUMP("init datas", mapInfo.data, mapInfo.size); >+ >+ concatenatedInitDataChunks.append(mapInfo.data, mapInfo.size); >+ m_handledProtectionEvents.add(GST_EVENT_SEQNUM(event)); >+ gst_buffer_unmap(data, &mapInfo); >+ >+ RunLoop::main().dispatch([this, eventKeySystemId, initData = WTFMove(concatenatedInitDataChunks)] { >+ GST_DEBUG("scheduling OnEncrypted event for %s with concatenated init datas size of %" G_GSIZE_FORMAT, eventKeySystemId, initData.size()); >+ GST_MEMDUMP("init datas", initData.data(), initData.size()); >+ this->m_player->initializationDataEncountered(ASCIILiteral("cenc"), ArrayBuffer::create(initData.data(), initData.size())); >+ }); > } > #endif > >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >index 691f0c8ac593d4ee49ed8448a83129074d1e996c..10eb9781574c559871c4aa89797a6e4e53edb975 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp >@@ -76,6 +76,11 @@ static GstPadProbeReturn appendPipelineAppsrcDataLeaving(GstPad*, GstPadProbeInf > #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 @@ AppendPipeline::AppendPipeline(Ref<MediaSourceClientGStreamerMSE> mediaSourceCli > 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 @@ AppendPipeline::~AppendPipeline() > 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 @@ static GstPadProbeReturn appendPipelinePadProbeDebugInformation(GstPad*, GstPadP > } > #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 appendPipeline 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); >+ break; >+ 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); >diff --git a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h >index 995c12975d94ec4c007ffeb2d79cfa7a45f53894..9ff8a154d998aa9cc49ec1434115eb76d945564d 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h >+++ b/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h >@@ -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 @@ public: > 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 @@ private: > 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.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185245
:
339550
|
339713
|
339813
|
339948