- Revision
- 236912
- Author
- [email protected]
- Date
- 2018-10-08 06:25:02 -0700 (Mon, 08 Oct 2018)
Log Message
[EME][GStreamer] Add support for WebM encrypted caps "application/x-webm-enc"
https://bugs.webkit.org/show_bug.cgi?id=189239
Patch by Yacine Bandou <[email protected]> on 2018-10-08
Reviewed by Xabier Rodriguez-Calvar.
Add the support of GStreamer caps "application/x-webm-enc" in GStreamerCommon.
The DRM system id field in the encrypted event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID
in case of WebM, for details, see https://bugzilla.gnome.org/attachment.cgi?id=365211.
Tests: media/encrypted-media/clearKey/clearKey-encrypted-webm-eventmse.html
media/encrypted-media/clearKey/clearKey-webm-video-playback-mse.html
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::capsMediaType):
(WebCore::areEncryptedCaps):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(webkitMediaCommonEncryptionDecryptTransformCaps):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (236911 => 236912)
--- trunk/Source/WebCore/ChangeLog 2018-10-08 06:18:17 UTC (rev 236911)
+++ trunk/Source/WebCore/ChangeLog 2018-10-08 13:25:02 UTC (rev 236912)
@@ -1,3 +1,27 @@
+2018-10-08 Yacine Bandou <[email protected]>
+
+ [EME][GStreamer] Add support for WebM encrypted caps "application/x-webm-enc"
+ https://bugs.webkit.org/show_bug.cgi?id=189239
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Add the support of GStreamer caps "application/x-webm-enc" in GStreamerCommon.
+
+ The DRM system id field in the encrypted event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID
+ in case of WebM, for details, see https://bugzilla.gnome.org/attachment.cgi?id=365211.
+
+ Tests: media/encrypted-media/clearKey/clearKey-encrypted-webm-eventmse.html
+ media/encrypted-media/clearKey/clearKey-webm-video-playback-mse.html
+
+ * platform/graphics/gstreamer/GStreamerCommon.cpp:
+ (WebCore::capsMediaType):
+ (WebCore::areEncryptedCaps):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
+ * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
+ * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
+ (webkitMediaCommonEncryptionDecryptTransformCaps):
+
2018-10-07 Dan Bernstein <[email protected]>
Fixed building with the latest macOS SDK
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp (236911 => 236912)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2018-10-08 06:18:17 UTC (rev 236911)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2018-10-08 13:25:02 UTC (rev 236912)
@@ -151,7 +151,7 @@
return nullptr;
}
#if ENABLE(ENCRYPTED_MEDIA)
- if (gst_structure_has_name(structure, "application/x-cenc"))
+ if (gst_structure_has_name(structure, "application/x-cenc") || gst_structure_has_name(structure, "application/x-webm-enc"))
return gst_structure_get_string(structure, "original-media-type");
#endif
return gst_structure_get_name(structure);
@@ -176,7 +176,7 @@
GST_WARNING("caps are empty");
return false;
}
- return gst_structure_has_name(structure, "application/x-cenc");
+ return gst_structure_has_name(structure, "application/x-cenc") || gst_structure_has_name(structure, "application/x-webm-enc");
#else
UNUSED_PARAM(caps);
return false;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (236911 => 236912)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-10-08 06:18:17 UTC (rev 236911)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-10-08 13:25:02 UTC (rev 236912)
@@ -1274,7 +1274,7 @@
// Check if the system key of the protection event is the same of the CDM instance.
// For example: we can receive a new Widevine protection event but the CDM instance initialized with
// Playready, so we ignore this event.
- if (m_cdmInstance && g_strcmp0(GStreamerEMEUtilities::keySystemToUuid(m_cdmInstance->keySystem()), eventKeySystemUUID)) {
+ if (m_cdmInstance && g_strcmp0(eventKeySystemUUID, GST_PROTECTION_UNSPECIFIED_SYSTEM_ID) && 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;
}
@@ -1296,7 +1296,8 @@
GST_DEBUG("scheduling initializationDataEncountered event for %s with init data size of %u", eventKeySystemUUID.utf8().data(), initData.sizeInBytes());
GST_MEMDUMP("init datas", reinterpret_cast<const uint8_t*>(initData.characters8()), initData.sizeInBytes());
- weakThis->m_player->initializationDataEncountered("cenc"_s, ArrayBuffer::create(reinterpret_cast<const uint8_t*>(initData.characters8()), initData.sizeInBytes()));
+ weakThis->m_player->initializationDataEncountered((eventKeySystemUUID == GST_PROTECTION_UNSPECIFIED_SYSTEM_ID) ? "webm"_s : "cenc"_s,
+ ArrayBuffer::create(reinterpret_cast<const uint8_t*>(initData.characters8()), initData.sizeInBytes()));
});
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp (236911 => 236912)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp 2018-10-08 06:18:17 UTC (rev 236911)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp 2018-10-08 13:25:02 UTC (rev 236912)
@@ -56,12 +56,14 @@
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS("application/x-cenc, original-media-type=(string)video/x-h264, protection-system=(string)" WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID "; "
- "application/x-cenc, original-media-type=(string)audio/mpeg, protection-system=(string)" WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID));
+ "application/x-cenc, original-media-type=(string)audio/mpeg, protection-system=(string)" WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID";"
+ "application/x-webm-enc, original-media-type=(string)video/x-vp8;"
+ "application/x-webm-enc, original-media-type=(string)video/x-vp9;"));
static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS("video/x-h264; audio/mpeg"));
+ GST_STATIC_CAPS("video/x-h264; audio/mpeg; video/x-vp8; video/x-vp9"));
#define webkit_media_clear_key_decrypt_parent_class parent_class
G_DEFINE_TYPE(WebKitMediaClearKeyDecrypt, webkit_media_clear_key_decrypt, WEBKIT_TYPE_MEDIA_CENC_DECRYPT);
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp (236911 => 236912)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp 2018-10-08 06:18:17 UTC (rev 236911)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp 2018-10-08 13:25:02 UTC (rev 236912)
@@ -127,7 +127,10 @@
const gchar* fieldName = gst_structure_nth_field_name(incomingStructure, j);
if (g_str_has_prefix(fieldName, "protection-system")
- || g_str_has_prefix(fieldName, "original-media-type"))
+ || g_str_has_prefix(fieldName, "original-media-type")
+ || g_str_has_prefix(fieldName, "encryption-algorithm")
+ || g_str_has_prefix(fieldName, "encoding-scope")
+ || g_str_has_prefix(fieldName, "cipher-mode"))
gst_structure_remove_field(outgoingStructure.get(), fieldName);
}
} else {
@@ -156,7 +159,8 @@
gst_structure_set(outgoingStructure.get(), "protection-system", G_TYPE_STRING, klass->protectionSystemId,
"original-media-type", G_TYPE_STRING, gst_structure_get_name(incomingStructure), nullptr);
- gst_structure_set_name(outgoingStructure.get(), "application/x-cenc");
+ gst_structure_set_name(outgoingStructure.get(),
+ !g_strcmp0(klass->protectionSystemId, GST_PROTECTION_UNSPECIFIED_SYSTEM_ID) ? "application/x-webm-enc" : "application/x-cenc");
}
bool duplicate = false;