-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Transition Legacy Fairplay CDM off AVStreamSession #12378
[Cocoa] Transition Legacy Fairplay CDM off AVStreamSession #12378
Conversation
EWS run on previous version of this PR (hash 2b6c8d3) |
2b6c8d3
to
e52af3e
Compare
EWS run on previous version of this PR (hash e52af3e) |
RetainPtr<NSData> nsInitData = m_initData ? m_initData->createNSData() : nil; | ||
NSData* nsIdentifier = m_identifier ? [NSData dataWithBytes:m_identifier->data() length:m_identifier->length()] : nil; | ||
if ([contentKeySession() respondsToSelector:@selector(processContentKeyRequestWithIdentifier:initializationData:options:)]) | ||
[contentKeySession() processContentKeyRequestWithIdentifier:nsIdentifier initializationData:nsInitData.get() options:nil]; | ||
else | ||
[contentKeySession() processContentKeyRequestInitializationData:nsInitData.get() options:nil]; | ||
m_hasKeyRequestSemaphore.waitFor(5_s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A commend and a named constant would help someone looking at this understand why we wait for exactly 5 seconds.
m_hasKeyRequestSemaphore.signal(); | ||
m_keyRequest = keyRequest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you signal the semaphore after setting m_keyRequest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(It won't matter in practice because the m_keyRequestLock
will protect access to the variable till after this method returns, but you're right that it's currently incorrect.)
e52af3e
to
3861d13
Compare
EWS run on previous version of this PR (hash 3861d13) |
3861d13
to
dd48368
Compare
EWS run on previous version of this PR (hash dd48368) |
dd48368
to
e9f85b0
Compare
https://bugs.webkit.org/show_bug.cgi?id=254992 rdar://107202864 Reviewed by Eric Carlson. Clients of the prefixed WebKit EME APIs using the Fairplay "V2" protocol will use a CDM implementation that relies upon AVStreamSession. This implementation will break when "sampleBufferContentKeySessionSupport" is enabled, as it relies upon platform changes only available through AVContentKeySession. Remove the AVStreamSession-based CDM implementation and funnel all support through the existing AVContentKeySession-based legacy CDM. At the same time, modify that AVContentKeySession-based CDM to query the "sampleBufferContentKeySessionSupport" setting and opt into the non-legacy AVContentKeySession path when it is enabled. Drive-by fix: When opting into the non-legacy codepath, the -contentKeySession:didProvideContentKeyRequest: delegate callbock becomes asynchronous. To retain the existing synchronous behavior of the CDM, set an explicit work queue for the delegate callbacks, and make the setting and getting of m_keyRequest thread-safe. Add a semaphore to be used to detect when the m_keyRequest value changes. Drive-by fix #2: Fix some unified-build included errors exposed by removing CDMSessionAVStreamSession.h Add LayoutTests for basic legacy EME API playback. * LayoutTests/http/tests/media/fairplay/legacy-eme.js: Added. (selectKeySystem): (async startLegacyEME): (extractContentId): (concatInitDataIdAndCertificate): * LayoutTests/http/tests/media/fairplay/legacy-fairplay-error-expected.txt: Added. * LayoutTests/http/tests/media/fairplay/legacy-fairplay-error.html: Added. * LayoutTests/http/tests/media/fairplay/legacy-fairplay-hls-expected.txt: Added. * LayoutTests/http/tests/media/fairplay/legacy-fairplay-hls.html: Added. * LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v2-expected.txt: Added. * LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v2.html: Added. * LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v3-expected.txt: Added. * LayoutTests/http/tests/media/fairplay/legacy-fairplay-mse-v3.html: Added. * LayoutTests/http/tests/media/fairplay/support.js: (uInt16ArrayToString): (stringToUint16Array): * Source/WTF/wtf/PlatformHave.h: * Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.cpp: (WebCore::platformRegisterFactories): * Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h: * Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm: * Source/WebCore/SourcesCocoa.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/platform/graphics/LegacyCDMSession.h: * Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: (WebCore::queryDecoderAvailability): (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): * Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h: * Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: (-[WebCDMSessionAVContentKeySessionDelegate contentKeySessionContentProtectionSessionIdentifierDidChange:]): (WebCore::CDMSessionAVContentKeySession::CDMSessionAVContentKeySession): (WebCore::CDMSessionAVContentKeySession::update): (WebCore::CDMSessionAVContentKeySession::hasContentKeyRequest const): (WebCore::CDMSessionAVContentKeySession::contentKeyRequest): (WebCore::CDMSessionAVContentKeySession::didProvideContentKeyRequest): (WebCore::CDMSessionAVContentKeySession::contentKeySession): * Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h: Removed. * Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: Removed. * Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h: (WebCore::toCDMSessionMediaSourceAVFObjC): * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::hasStreamSession): Deleted. * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession): (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession): Deleted. * Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: (WebCore::SourceBufferPrivateAVFObjC::didProvideMediaDataForTrackId): (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID): (WebCore::SourceBufferPrivateAVFObjC::destroyStreamDataParser): (WebCore::copyKeyIDs): Deleted. * Tools/TestWebKitAPI/Tests/WebCore/cocoa/AVFoundationSoftLinkTest.mm: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/262647@main
e9f85b0
to
2ef8f77
Compare
Committed 262647@main (2ef8f77): https://commits.webkit.org/262647@main Reviewed commits have been landed. Closing PR #12378 and removing active labels. |
2ef8f77
e9f85b0