Changeset 235610 in webkit
- Timestamp:
- Sep 4, 2018 3:27:27 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r235607 r235610 1 2018-09-04 Yacine Bandou <yacine.bandou_ext@softathome.com> 2 3 [EME] Add the WebM initData support in ClearKey CDM 4 https://bugs.webkit.org/show_bug.cgi?id=189240 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 Add the "webm" initDataType support in ClearKey CDM. 9 Read the WebM initData by following the W3C spec https://www.w3.org/TR/eme-initdata-webm/#common-system, 10 and put it in JSON object format like is specified in https://www.w3.org/TR/encrypted-media/#clear-key-request-format. 11 12 Tests: media/encrypted-media/clearKey/clearKey-encrypted-webm-event-mse.html 13 media/encrypted-media/clearKey/clearKey-webm-video-playback-mse.html 14 15 * platform/encryptedmedia/clearkey/CDMClearKey.cpp: 16 (WebCore::extractKeyIdFromWebMInitData): 17 (WebCore::CDMPrivateClearKey::supportsInitDataType const): 18 (WebCore::CDMPrivateClearKey::supportsInitData const): 19 (WebCore::CDMInstanceClearKey::requestLicense): 20 1 21 2018-09-03 Andy Estes <aestes@apple.com> 2 22 -
trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp
r232613 r235610 264 264 } 265 265 266 static Ref<SharedBuffer> extractKeyIdFromWebMInitData(const SharedBuffer& initData) 267 { 268 Ref<SharedBuffer> keyIds = SharedBuffer::create(); 269 270 // Check if initData is a valid WebM initData. 271 if (initData.isEmpty() || initData.size() > std::numeric_limits<unsigned>::max()) 272 return keyIds; 273 274 auto object = JSON::Object::create(); 275 auto keyIdsArray = JSON::Array::create(); 276 277 // Read the KeyId 278 // 9.1.3 License Request Format 279 // This section describes the format of the license request provided to the application via the message attribute of the message event. 280 // The format is a JSON object containing the following members: 281 // "kids" 282 // An array of key IDs. Each element of the array is the base64url encoding of the octet sequence containing the key ID value. 283 String keyId = WTF::base64URLEncode(initData.data(), initData.size()); 284 keyIdsArray->pushString(keyId); 285 286 object->setArray("kids", WTFMove(keyIdsArray)); 287 CString jsonData = object->toJSONString().utf8(); 288 keyIds->append(jsonData.data(), jsonData.length()); 289 return keyIds; 290 } 291 266 292 CDMFactoryClearKey& CDMFactoryClearKey::singleton() 267 293 { … … 295 321 { 296 322 // `keyids` and 'cenc' are the only supported init data type. 297 return (equalLettersIgnoringASCIICase(initDataType, "keyids") || equalLettersIgnoringASCIICase(initDataType, "cenc") );323 return (equalLettersIgnoringASCIICase(initDataType, "keyids") || equalLettersIgnoringASCIICase(initDataType, "cenc") || equalLettersIgnoringASCIICase(initDataType, "webm")); 298 324 } 299 325 … … 404 430 // Validate the initData buffer as CENC initData. 405 431 if (equalLettersIgnoringASCIICase(initDataType, "cenc") && isCencInitData(initData)) 432 return true; 433 434 // Validate the initData buffer as WebM initData. 435 if (equalLettersIgnoringASCIICase(initDataType, "webm") && !initData.isEmpty()) 406 436 return true; 407 437 … … 471 501 if (equalLettersIgnoringASCIICase(initDataType, "cenc")) 472 502 initData = extractKeyidsFromCencInitData(initData.get()); 503 504 if (equalLettersIgnoringASCIICase(initDataType, "webm")) 505 initData = extractKeyIdFromWebMInitData(initData.get()); 473 506 474 507 callOnMainThread(
Note: See TracChangeset
for help on using the changeset viewer.