Modified: trunk/Source/WebCore/ChangeLog (269032 => 269033)
--- trunk/Source/WebCore/ChangeLog 2020-10-27 12:30:53 UTC (rev 269032)
+++ trunk/Source/WebCore/ChangeLog 2020-10-27 13:00:41 UTC (rev 269033)
@@ -1,3 +1,18 @@
+2020-10-27 Xabier Rodriguez Calvar <[email protected]>
+
+ [EME][GStreamer] Decode base64 init data if needed
+ https://bugs.webkit.org/show_bug.cgi?id=218175
+
+ Reviewed by Philippe Normand.
+
+ There are certain strings with certain key systems that deliver
+ initialization data encoded as base64 so we need to decode it
+ first.
+
+ * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
+ (WebCore::InitData::InitData):
+ (WebCore::InitData::decodeBase64IfNeeded):
+
2020-10-15 Sergio Villar Senin <[email protected]>
[WebXR] Move OpenXR calls off the main thread
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h (269032 => 269033)
--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h 2020-10-27 12:30:53 UTC (rev 269032)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h 2020-10-27 13:00:41 UTC (rev 269033)
@@ -26,6 +26,7 @@
#include "GStreamerCommon.h"
#include "SharedBuffer.h"
#include <gst/gst.h>
+#include <wtf/text/Base64.h>
#include <wtf/text/WTFString.h>
#define WEBCORE_GSTREAMER_EME_UTILITIES_CLEARKEY_UUID "1077efec-c0b2-4d02-ace3-3c1e52e2fb4b"
@@ -51,6 +52,7 @@
ASSERT_NOT_REACHED();
}
m_payload = mappedInitData->createSharedBuffer();
+ decodeBase64IfNeeded();
}
InitData(const String& systemId, RefPtr<SharedBuffer>&& payload)
@@ -57,6 +59,7 @@
: m_systemId(systemId)
, m_payload(WTFMove(payload))
{
+ decodeBase64IfNeeded();
}
void append(InitData&& initData)
@@ -75,6 +78,22 @@
m_payload->append(*initData.payload());
}
+ void decodeBase64IfNeeded()
+ {
+ GST_CAT_LEVEL_LOG(webkit_media_common_encryption_decrypt_debug_category, GST_LEVEL_TRACE, nullptr, "payload size %zu", m_payload->size());
+ if (!m_payload->size())
+ return;
+
+ Vector<char> out;
+ if (!base64Decode(m_payload->data(), m_payload->size(), out)) {
+ GST_CAT_LEVEL_LOG(webkit_media_common_encryption_decrypt_debug_category, GST_LEVEL_TRACE, nullptr, "payload did not decode base64, considering ok");
+ return;
+ }
+
+ GST_CAT_LEVEL_LOG(webkit_media_common_encryption_decrypt_debug_category, GST_LEVEL_TRACE, nullptr, "payload decoded to base64, new size %zu", out.size());
+ m_payload = SharedBuffer::create(out.data(), out.size());
+ }
+
const RefPtr<SharedBuffer>& payload() const { return m_payload; }
const String& systemId() const { return m_systemId; }
String payloadContainerType() const