WebKit Bugzilla
Attachment 348770 Details for
Bug 189240
: [EME] Add the WebM initData support in ClearKey CDM
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189240-20180903155358.patch (text/plain), 4.63 KB, created by
Yacine Bandou
on 2018-09-03 06:53:59 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yacine Bandou
Created:
2018-09-03 06:53:59 PDT
Size:
4.63 KB
patch
obsolete
>Subversion Revision: 235549 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c0c33ed2d31fbb77ee15b61876f3525ab2a5e9e1..16638c9261a0dbb4b59bfeaf7739fe9c5fd6b3c9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-09-03 Yacine Bandou <yacine.bandou_ext@softathome.com> >+ >+ [EME] Add the WebM initData support in ClearKey CDM >+ https://bugs.webkit.org/show_bug.cgi?id=189240 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add the "webm" initDataType support in ClearKey CDM. >+ Read the WebM initData by following the W3C spec https://www.w3.org/TR/eme-initdata-webm/#common-system, >+ and put it in JSON object format like is specified in https://www.w3.org/TR/encrypted-media/#clear-key-request-format. >+ >+ Tests: media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html >+ media/encrypted-media/clearKey/clearKey-webm-video-playback-mse.html >+ >+ * platform/encryptedmedia/clearkey/CDMClearKey.cpp: >+ (WebCore::getKeyidFromWebMInitData): >+ (WebCore::CDMPrivateClearKey::supportsInitDataType const): >+ (WebCore::CDMPrivateClearKey::supportsInitData const): >+ (WebCore::CDMInstanceClearKey::requestLicense): >+ > 2018-09-03 Yacine Bandou <yacine.bandou_ext@softathome.com> > > [EME][GStreamer] Add support for WebM encrypted caps "application/x-webm-enc" >diff --git a/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp b/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp >index b452780d11173000667c28ab3aef8a69d984c646..cc683cd426e543d941a6364ce040affe6e8521ed 100644 >--- a/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp >+++ b/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp >@@ -263,6 +263,32 @@ static Ref<SharedBuffer> extractKeyidsFromCencInitData(const SharedBuffer& initD > return keyIds; > } > >+static Ref<SharedBuffer> getKeyidFromWebMInitData(const SharedBuffer& initData) >+{ >+ Ref<SharedBuffer> keyIds = SharedBuffer::create(); >+ >+ // Check if initData is a valid WebM initData. >+ if (initData.isEmpty() || initData.size() > std::numeric_limits<unsigned>::max()) >+ return keyIds; >+ >+ auto object = JSON::Object::create(); >+ auto keyIdsArray = JSON::Array::create(); >+ >+ // Read the KeyId >+ // 9.1.3 License Request Format >+ // This section describes the format of the license request provided to the application via the message attribute of the message event. >+ // The format is a JSON object containing the following members: >+ // "kids" >+ // An array of key IDs. Each element of the array is the base64url encoding of the octet sequence containing the key ID value. >+ String keyId = WTF::base64URLEncode(initData.data(), initData.size()); >+ keyIdsArray->pushString(keyId); >+ >+ object->setArray("kids", WTFMove(keyIdsArray)); >+ CString jsonData = object->toJSONString().utf8(); >+ keyIds->append(jsonData.data(), jsonData.length()); >+ return keyIds; >+} >+ > CDMFactoryClearKey& CDMFactoryClearKey::singleton() > { > static NeverDestroyed<CDMFactoryClearKey> s_factory; >@@ -294,7 +320,7 @@ CDMPrivateClearKey::~CDMPrivateClearKey() = default; > bool CDMPrivateClearKey::supportsInitDataType(const AtomicString& initDataType) const > { > // `keyids` and 'cenc' are the only supported init data type. >- return (equalLettersIgnoringASCIICase(initDataType, "keyids") || equalLettersIgnoringASCIICase(initDataType, "cenc")); >+ return (equalLettersIgnoringASCIICase(initDataType, "keyids") || equalLettersIgnoringASCIICase(initDataType, "cenc") || equalLettersIgnoringASCIICase(initDataType, "webm")); > } > > static bool containsPersistentLicenseType(const Vector<CDMSessionType>& types) >@@ -405,6 +431,10 @@ bool CDMPrivateClearKey::supportsInitData(const AtomicString& initDataType, cons > if (equalLettersIgnoringASCIICase(initDataType, "cenc") && isCencInitData(initData)) > return true; > >+ // Validate the initData buffer as WebM initData. >+ if (equalLettersIgnoringASCIICase(initDataType, "webm") && !initData.isEmpty()) >+ return true; >+ > return false; > } > >@@ -471,6 +501,9 @@ void CDMInstanceClearKey::requestLicense(LicenseType, const AtomicString& initDa > if (equalLettersIgnoringASCIICase(initDataType, "cenc")) > initData = extractKeyidsFromCencInitData(initData.get()); > >+ if (equalLettersIgnoringASCIICase(initDataType, "webm")) >+ initData = getKeyidFromWebMInitData(initData.get()); >+ > callOnMainThread( > [weakThis = makeWeakPtr(*this), callback = WTFMove(callback), initData = WTFMove(initData), sessionIdValue = s_sessionIdValue]() mutable { > if (!weakThis)
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 189240
:
348770
|
348809