-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 12dd6bd. rdar://122030589
[Cocoa] EME with encrypted MPEG2-TS fails to begin playback https://bugs.webkit.org/show_bug.cgi?id=268948 rdar://122030589 Reviewed by Andy Estes. When encrypted samples are parsed from containers by AVStreamDataParser, those samples have their associated initialization data attached to their CMFormatDescription as extensions. WebKit then reads those initialization data from the format description to determine the keyID needed to decrypt that key. For MPEG2-TS files, the initialization data is stored in a different key/value pair. Explicitly support this initData type as 'mpts'. * LayoutTests/http/tests/media/fairplay/content/elementary-stream-video-keyid-1.ts: Added. * LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-mpts.html: Added. * Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSinf): (WebCore::CDMPrivateFairPlayStreaming::mptsName): (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsMpts): (WebCore::CDMPrivateFairPlayStreaming::sanitizeMpts): (WebCore::CDMPrivateFairPlayStreaming::mptsKeyIDs): (WebCore::validInitDataTypes): (WebCore::CDMFactory::platformRegisterFactories): (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const): * Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.h: * Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: (WebCore::keyIDsForRequest): (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestLicense): * Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::MediaSampleAVFObjC::commonInit): * Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID): Canonical link: https://commits.webkit.org/274351@main Identifier: 272448.561@safari-7618.1.15.10-branch
- Loading branch information
Showing
10 changed files
with
223 additions
and
19 deletions.
There are no files selected for viewing
Binary file added
BIN
+1.1 MB
LayoutTests/http/tests/media/fairplay/content/elementary-stream-video-keyid-1.ts
Binary file not shown.
23 changes: 23 additions & 0 deletions
23
LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-mpts-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
PROMISE: requestMediaKeySystemAccess resolved | ||
PROMISE: createMediaKeys resolved | ||
FETCH: resources/cert.der OK | ||
PROMISE: keys.setServerCertificate resolved | ||
PROMISE: setMediaKeys() resolved | ||
Created mediaSource | ||
EVENT(sourceopen) | ||
- | ||
Appending Encrypted Video Payload | ||
Created sourceBuffer | ||
FETCH: content/elementary-stream-video-keyid-1.ts OK | ||
EVENT(encrypted) | ||
EVENT(message) | ||
PROMISE: licenseResponse resolved | ||
PROMISE: session.update() resolved | ||
EVENT(updateend) | ||
- | ||
Playing video | ||
EVENT(seeked) | ||
Promise resolved OK | ||
END OF TEST | ||
|
48 changes: 48 additions & 0 deletions
48
LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-mpts.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>fps-mse-unmuxed-same-key</title> | ||
<script src=../../../media-resources/video-test.js></script> | ||
<script src=support.js></script> | ||
<script src="eme2016.js"></script> | ||
<script> | ||
window.addEventListener('load', async event => { | ||
startTest().then(endTest).catch(failTest); | ||
}); | ||
|
||
async function startTest() { | ||
let video = document.querySelector('video'); | ||
let keys = await startEME({video: video, setMediaKeys: true, capabilities: [{ | ||
initDataTypes: ['mpts'], | ||
audioCapabilities: [{ contentType: 'audio/mp4', robustness: '' }], | ||
videoCapabilities: [{ contentType: 'video/mp4', robustness: '' }], | ||
distinctiveIdentifier: 'not-allowed', | ||
persistentState: 'not-allowed', | ||
sessionTypes: ['temporary'], | ||
}]}); | ||
|
||
let mediaSource = new MediaSource; | ||
video.srcObject = mediaSource; | ||
consoleWrite('Created mediaSource'); | ||
await waitFor(mediaSource, 'sourceopen'); | ||
|
||
consoleWrite('-'); | ||
consoleWrite('Appending Encrypted Video Payload'); | ||
|
||
let {sourceBuffer: sourceBuffer, session: session} = await createBufferAppendAndWaitForEncrypted(video, mediaSource, keys, 'video/mp4', 'content/elementary-stream-video-keyid-1.ts'); | ||
|
||
consoleWrite('-'); | ||
consoleWrite('Playing video'); | ||
|
||
mediaSource.duration = sourceBuffer.buffered.end(0); | ||
video.currentTime = sourceBuffer.buffered.start(0); | ||
await waitFor(video, 'seeked'); | ||
|
||
await shouldResolve(video.play()); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<video controls width="480"></video> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters