WebKit Bugzilla
Attachment 340182 Details for
Bug 185535
: [EME][GStreamer] Handle the protection event in MediaPlayerPrivate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185535-20180511113950.patch (text/plain), 6.14 KB, created by
Yacine Bandou
on 2018-05-11 02:39:46 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yacine Bandou
Created:
2018-05-11 02:39:46 PDT
Size:
6.14 KB
patch
obsolete
>Subversion Revision: 231637 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cd794e4d4c9ea2e6629d5edc6029c53dfbdcb726..dace17655422d4f1c4c243e87e4d721ddbcc05df 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-05-10 Yacine Bandou <yacine.bandou_ext@softathome.com> >+ >+ [EME][GStreamer] Handle the protection event in MediaPlayerPrivate >+ https://bugs.webkit.org/show_bug.cgi?id=185535 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch is based on this calvaris's commit >+ https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d966168b0d2b65f9ca9415426e26d3752c78b03e >+ >+ It adds a handler for the protection event in MediaPalyerPrivate, it extracts the InitData from the event >+ and sends the encrypted event to JS via HTMLMediaElement. >+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: >+ (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered): >+ (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent): >+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: >+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Add a new type InitData. >+ > 2018-05-10 Yacine Bandou <yacine.bandou_ext@softathome.com> > > [EME][GStreamer] Add a handler for GStreamer protection event >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >index 274f070b6412343044ee125a412b51742bac8243..1d233e27f4788d5380448795abace26101c11418 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp >@@ -1204,6 +1204,43 @@ unsigned MediaPlayerPrivateGStreamerBase::videoDecodedByteCount() const > } > > #if ENABLE(ENCRYPTED_MEDIA) >+void MediaPlayerPrivateGStreamerBase::initializationDataEncountered(GstEvent* event) >+{ >+ // FIXME: Inform that we are waiting for a key. >+ const char* eventKeySystemUUID = nullptr; >+ GstBuffer* data = nullptr; >+ gst_event_parse_protection(event, &eventKeySystemUUID, &data, nullptr); >+ >+ // Check if the system key of the protection event is the same of the CDM instance. >+ // For example: we can receive a new a Widevine protection event but the CDM instance initialized with >+ // Palyread, so we ignore this event. >+ if (m_cdmInstance && g_strcmp0(GStreamerEMEUtilities::keySystemToUuid(m_cdmInstance->keySystem()), eventKeySystemUUID)) { >+ GST_DEBUG("The protection event with UUID %s is ignored because it isn't supported by the CDM %s", eventKeySystemUUID, m_cdmInstance->keySystem().utf8().data()); >+ return; >+ } >+ >+ GstMapInfo mapInfo; >+ if (!gst_buffer_map(data, &mapInfo, GST_MAP_READ)) { >+ GST_WARNING("cannot map %s protection data", eventKeySystemUUID); >+ return; >+ } >+ >+ GST_TRACE("init data encountered for %s of size %" G_GSIZE_FORMAT, eventKeySystemUUID, mapInfo.size); >+ GST_MEMDUMP("init data", reinterpret_cast<const uint8_t*>(mapInfo.data), mapInfo.size); >+ InitData initData(reinterpret_cast<const uint8_t*>(mapInfo.data), mapInfo.size); >+ gst_buffer_unmap(data, &mapInfo); >+ >+ String eventKeySystemUUIDString = eventKeySystemUUID; >+ RunLoop::main().dispatch([weakThis = m_weakPtrFactory.createWeakPtr(*this), eventKeySystemUUID = eventKeySystemUUIDString, initData] { >+ if (!weakThis) >+ return; >+ >+ GST_DEBUG("scheduling initializationDataEncountered event for %s with init data size of %" G_GSIZE_FORMAT, eventKeySystemUUID.utf8().data(), initData.sizeInBytes()); >+ GST_MEMDUMP("init datas", reinterpret_cast<const uint8_t*>(initData.characters8()), initData.sizeInBytes()); >+ weakThis->m_player->initializationDataEncountered(ASCIILiteral("cenc"), ArrayBuffer::create(reinterpret_cast<const uint8_t*>(initData.characters8()), initData.sizeInBytes())); >+ }); >+} >+ > void MediaPlayerPrivateGStreamerBase::cdmInstanceAttached(CDMInstance& instance) > { > if (m_cdmInstance != &instance) { >@@ -1256,18 +1293,9 @@ void MediaPlayerPrivateGStreamerBase::handleProtectionEvent(GstEvent* event) > { > 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(); >+ initializationDataEncountered(event); > } > #endif > >diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h >index 64ffb8def3de5a1ffd1df510c33bd758f0916eaa..342e7959b7c8d58f46cf0d7edd3f221b95d423c4 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h >+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h >@@ -144,6 +144,7 @@ public: > void attemptToDecryptWithLocalInstance(); > void attemptToDecryptWithInstance(CDMInstance&) override; > void dispatchCDMInstance(); >+ void initializationDataEncountered(GstEvent*); > #endif > > static bool supportsKeySystem(const String& keySystem, const String& mimeType); >diff --git a/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h b/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h >index 5410cb2296a3225d2c15a831505c1f7f448a2029..0cff539b20e9653ff9237d0715facd0c439ebf69 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h >+++ b/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h >@@ -31,6 +31,8 @@ > > namespace WebCore { > >+using InitData = String; >+ > class GStreamerEMEUtilities { > > public:
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 185535
:
340149
|
340182
|
340184