Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cocoa] EME with encrypted MPEG2-TS fails to begin playback #24043

Conversation

jernoble
Copy link
Contributor

@jernoble jernoble commented Feb 7, 2024

12dd6bd

[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

f71af30

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings   πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
❌ πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  gtk
  πŸ›  πŸ§ͺ jsc βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2 ❌ πŸ§ͺ api-gtk
  πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ›  jsc-armv7
βœ… πŸ›  πŸ§ͺ merge   πŸ›  watch βœ… πŸ§ͺ jsc-armv7-tests
βœ… πŸ›  watch-sim

@jernoble jernoble self-assigned this Feb 7, 2024
@jernoble jernoble added the Media Bugs related to the HTML 5 Media elements. label Feb 7, 2024
@jernoble jernoble force-pushed the eng/Cocoa-EME-with-encrypted-MPEG2-TS-fails-to-begin-playback branch 2 times, most recently from 41fe7c0 to 96a4526 Compare February 8, 2024 00:01
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 8, 2024
@jernoble
Copy link
Contributor Author

jernoble commented Feb 8, 2024

Looks like failing tests will require bot upgrades to newer platform OSs. Will skip for now.

@jernoble jernoble removed the merging-blocked Applied to prevent a change from being merged label Feb 8, 2024
@jernoble jernoble force-pushed the eng/Cocoa-EME-with-encrypted-MPEG2-TS-fails-to-begin-playback branch from 96a4526 to 5e4aeec Compare February 8, 2024 19:27
@jernoble jernoble changed the title [Cocoa] EME with encrypted MPEG2-TS fails to begin playback Add interfaces and stubs for the Web Extensions DevTools APIs. Feb 8, 2024
@jernoble jernoble force-pushed the eng/Cocoa-EME-with-encrypted-MPEG2-TS-fails-to-begin-playback branch from 5e4aeec to 5b4892a Compare February 8, 2024 22:38
@jernoble jernoble added WebKit Extensions Bugs related to extension support. and removed Media Bugs related to the HTML 5 Media elements. labels Feb 8, 2024
@jernoble jernoble changed the title Add interfaces and stubs for the Web Extensions DevTools APIs. [Cocoa] EME with encrypted MPEG2-TS fails to begin playback Feb 9, 2024
@jernoble jernoble force-pushed the eng/Cocoa-EME-with-encrypted-MPEG2-TS-fails-to-begin-playback branch from 5b4892a to 80182a7 Compare February 9, 2024 00:16
@jernoble jernoble added Media Bugs related to the HTML 5 Media elements. and removed WebKit Extensions Bugs related to extension support. labels Feb 9, 2024
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 80182a7. Live statuses available at the PR page, #24043

@jernoble jernoble force-pushed the eng/Cocoa-EME-with-encrypted-MPEG2-TS-fails-to-begin-playback branch from 80182a7 to f71af30 Compare February 9, 2024 02:01
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for f71af30. Live statuses available at the PR page, #24043

@jernoble jernoble added the merge-queue Applied to send a pull request to merge-queue label Feb 9, 2024
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
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Cocoa-EME-with-encrypted-MPEG2-TS-fails-to-begin-playback branch from f71af30 to 12dd6bd Compare February 9, 2024 08:57
@webkit-commit-queue
Copy link
Collaborator

Committed 274351@main (12dd6bd): https://commits.webkit.org/274351@main

Reviewed commits have been landed. Closing PR #24043 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 12dd6bd into WebKit:main Feb 9, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Media Bugs related to the HTML 5 Media elements.
Projects
None yet
6 participants