Title: [269103] trunk/Source/WebCore
Revision
269103
Author
[email protected]
Date
2020-10-28 08:24:44 -0700 (Wed, 28 Oct 2020)

Log Message

[GStreamer][EME][Thunder] Do not sanitize CENC init data
https://bugs.webkit.org/show_bug.cgi?id=218182

Reviewed by Philippe Normand.

In certain cases, like smoothstreaming with PlayReady, the init
datas we are getting are correct but are not in PSSH box format
they would be "sanitized away". In this patch you can enable
sanitization customization depending on the CDM you're using.

* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::sanitizeInitData):
* platform/encryptedmedia/CDMPrivate.cpp:
(WebCore::CDMPrivate::sanitizeInitData const):
* platform/encryptedmedia/CDMPrivate.h:
* platform/graphics/gstreamer/eme/CDMThunder.cpp:
(WebCore::CDMPrivateThunder::sanitizeInitData const):
* platform/graphics/gstreamer/eme/CDMThunder.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269102 => 269103)


--- trunk/Source/WebCore/ChangeLog	2020-10-28 13:14:48 UTC (rev 269102)
+++ trunk/Source/WebCore/ChangeLog	2020-10-28 15:24:44 UTC (rev 269103)
@@ -1,3 +1,24 @@
+2020-10-28  Xabier Rodriguez Calvar  <[email protected]>
+
+        [GStreamer][EME][Thunder] Do not sanitize CENC init data
+        https://bugs.webkit.org/show_bug.cgi?id=218182
+
+        Reviewed by Philippe Normand.
+
+        In certain cases, like smoothstreaming with PlayReady, the init
+        datas we are getting are correct but are not in PSSH box format
+        they would be "sanitized away". In this patch you can enable
+        sanitization customization depending on the CDM you're using.
+
+        * Modules/encryptedmedia/CDM.cpp:
+        (WebCore::CDM::sanitizeInitData):
+        * platform/encryptedmedia/CDMPrivate.cpp:
+        (WebCore::CDMPrivate::sanitizeInitData const):
+        * platform/encryptedmedia/CDMPrivate.h:
+        * platform/graphics/gstreamer/eme/CDMThunder.cpp:
+        (WebCore::CDMPrivateThunder::sanitizeInitData const):
+        * platform/graphics/gstreamer/eme/CDMThunder.h:
+
 2020-10-28  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Add support for case when nested vertical alignment affects the root inlinebox vertical position

Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp (269102 => 269103)


--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp	2020-10-28 13:14:48 UTC (rev 269102)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp	2020-10-28 15:24:44 UTC (rev 269103)
@@ -137,7 +137,9 @@
 
 RefPtr<SharedBuffer> CDM::sanitizeInitData(const AtomString& initDataType, const SharedBuffer& initData)
 {
-    return InitDataRegistry::shared().sanitizeInitData(initDataType, initData);
+    if (!m_private)
+        return nullptr;
+    return m_private->sanitizeInitData(initDataType, initData);
 }
 
 bool CDM::supportsInitData(const AtomString& initDataType, const SharedBuffer& initData)

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMPrivate.cpp (269102 => 269103)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMPrivate.cpp	2020-10-28 13:14:48 UTC (rev 269102)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMPrivate.cpp	2020-10-28 15:24:44 UTC (rev 269103)
@@ -32,6 +32,7 @@
 #include "CDMMediaCapability.h"
 #include "CDMRequirement.h"
 #include "CDMRestrictions.h"
+#include "InitDataRegistry.h"
 #include "MediaPlayer.h"
 #include "NotImplemented.h"
 #include "ParsedContentType.h"
@@ -514,7 +515,12 @@
     callback(ConsentStatus::Allowed, WTFMove(accumulatedConfiguration), WTFMove(restrictions));
 }
 
+RefPtr<SharedBuffer> CDMPrivate::sanitizeInitData(const AtomString& initDataType, const SharedBuffer& initData) const
+{
+    return InitDataRegistry::shared().sanitizeInitData(initDataType, initData);
+}
 
+
 }
 
 #endif

Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMPrivate.h (269102 => 269103)


--- trunk/Source/WebCore/platform/encryptedmedia/CDMPrivate.h	2020-10-28 13:14:48 UTC (rev 269102)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMPrivate.h	2020-10-28 15:24:44 UTC (rev 269103)
@@ -74,6 +74,7 @@
     virtual bool supportsServerCertificates() const = 0;
     virtual bool supportsSessions() const = 0;
     virtual bool supportsInitData(const AtomString&, const SharedBuffer&) const = 0;
+    WEBCORE_EXPORT virtual RefPtr<SharedBuffer> sanitizeInitData(const AtomString& initDataType, const SharedBuffer& initData) const;
     virtual RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const = 0;
     virtual Optional<String> sanitizeSessionId(const String&) const = 0;
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp (269102 => 269103)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp	2020-10-28 13:14:48 UTC (rev 269102)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.cpp	2020-10-28 15:24:44 UTC (rev 269103)
@@ -218,6 +218,15 @@
     return false;
 }
 
+RefPtr<SharedBuffer> CDMPrivateThunder::sanitizeInitData(const AtomString& initDataType, const SharedBuffer& initData) const
+{
+    // Validate the initData buffer as CENC initData. FIXME: Validate it is actually CENC.
+    if (equalLettersIgnoringASCIICase(initDataType, "cenc") && !initData.isEmpty())
+        return initData.copy();
+
+    return CDMPrivate::sanitizeInitData(initDataType, initData);
+}
+
 RefPtr<SharedBuffer> CDMPrivateThunder::sanitizeResponse(const SharedBuffer& response) const
 {
     return response.copy();

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h (269102 => 269103)


--- trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h	2020-10-28 13:14:48 UTC (rev 269102)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/eme/CDMThunder.h	2020-10-28 15:24:44 UTC (rev 269103)
@@ -95,6 +95,7 @@
     bool supportsServerCertificates() const final;
     bool supportsSessions() const final;
     bool supportsInitData(const AtomString&, const SharedBuffer&) const final;
+    RefPtr<SharedBuffer> sanitizeInitData(const AtomString& initDataType, const SharedBuffer& initData) const final;
     RefPtr<SharedBuffer> sanitizeResponse(const SharedBuffer&) const final;
     Optional<String> sanitizeSessionId(const String&) const final;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to