Diff
Modified: branches/safari-611.1.9-branch/Source/WTF/ChangeLog (270907 => 270908)
--- branches/safari-611.1.9-branch/Source/WTF/ChangeLog 2020-12-16 21:07:59 UTC (rev 270907)
+++ branches/safari-611.1.9-branch/Source/WTF/ChangeLog 2020-12-16 21:20:59 UTC (rev 270908)
@@ -1,3 +1,42 @@
+2020-12-16 Alan Coon <[email protected]>
+
+ Cherry-pick r270872. rdar://problem/72396884
+
+ [Cocoa] Adopt -externalContentProtectionStatus
+ https://bugs.webkit.org/show_bug.cgi?id=219911
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ Adopt a new AVContentKeyRequest API which provides a "pending" status (in addition to usable/unusable).
+
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::protectionStatusForDisplayID const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): Deleted.
+
+ Source/WebCore/PAL:
+
+ * pal/spi/cocoa/AVFoundationSPI.h:
+
+ Source/WTF:
+
+ * wtf/PlatformHave.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-12-15 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -externalContentProtectionStatus
+ https://bugs.webkit.org/show_bug.cgi?id=219911
+
+ Reviewed by Eric Carlson.
+
+ * wtf/PlatformHave.h:
+
2020-12-14 Russell Epstein <[email protected]>
Cherry-pick r270758. rdar://problem/72303521
Modified: branches/safari-611.1.9-branch/Source/WTF/wtf/PlatformHave.h (270907 => 270908)
--- branches/safari-611.1.9-branch/Source/WTF/wtf/PlatformHave.h 2020-12-16 21:07:59 UTC (rev 270907)
+++ branches/safari-611.1.9-branch/Source/WTF/wtf/PlatformHave.h 2020-12-16 21:20:59 UTC (rev 270908)
@@ -808,3 +808,8 @@
#define HAVE_MT_PLUGIN_SAMPLE_CURSOR_PLAYABLE_HORIZON 1
#endif
#endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 110200) \
+ || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140400)
+#define HAVE_AVCONTENTKEYREQUEST_PENDING_PROTECTION_STATUS 1
+#endif
Modified: branches/safari-611.1.9-branch/Source/WebCore/ChangeLog (270907 => 270908)
--- branches/safari-611.1.9-branch/Source/WebCore/ChangeLog 2020-12-16 21:07:59 UTC (rev 270907)
+++ branches/safari-611.1.9-branch/Source/WebCore/ChangeLog 2020-12-16 21:20:59 UTC (rev 270908)
@@ -1,3 +1,48 @@
+2020-12-16 Alan Coon <[email protected]>
+
+ Cherry-pick r270872. rdar://problem/72396884
+
+ [Cocoa] Adopt -externalContentProtectionStatus
+ https://bugs.webkit.org/show_bug.cgi?id=219911
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ Adopt a new AVContentKeyRequest API which provides a "pending" status (in addition to usable/unusable).
+
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::protectionStatusForDisplayID const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): Deleted.
+
+ Source/WebCore/PAL:
+
+ * pal/spi/cocoa/AVFoundationSPI.h:
+
+ Source/WTF:
+
+ * wtf/PlatformHave.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-12-15 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -externalContentProtectionStatus
+ https://bugs.webkit.org/show_bug.cgi?id=219911
+
+ Reviewed by Eric Carlson.
+
+ Adopt a new AVContentKeyRequest API which provides a "pending" status (in addition to usable/unusable).
+
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::protectionStatusForDisplayID const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): Deleted.
+
2020-12-14 Russell Epstein <[email protected]>
Cherry-pick r270758. rdar://problem/72303521
Modified: branches/safari-611.1.9-branch/Source/WebCore/PAL/ChangeLog (270907 => 270908)
--- branches/safari-611.1.9-branch/Source/WebCore/PAL/ChangeLog 2020-12-16 21:07:59 UTC (rev 270907)
+++ branches/safari-611.1.9-branch/Source/WebCore/PAL/ChangeLog 2020-12-16 21:20:59 UTC (rev 270908)
@@ -1,3 +1,42 @@
+2020-12-16 Alan Coon <[email protected]>
+
+ Cherry-pick r270872. rdar://problem/72396884
+
+ [Cocoa] Adopt -externalContentProtectionStatus
+ https://bugs.webkit.org/show_bug.cgi?id=219911
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ Adopt a new AVContentKeyRequest API which provides a "pending" status (in addition to usable/unusable).
+
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::protectionStatusForDisplayID const):
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const): Deleted.
+
+ Source/WebCore/PAL:
+
+ * pal/spi/cocoa/AVFoundationSPI.h:
+
+ Source/WTF:
+
+ * wtf/PlatformHave.h:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-12-15 Jer Noble <[email protected]>
+
+ [Cocoa] Adopt -externalContentProtectionStatus
+ https://bugs.webkit.org/show_bug.cgi?id=219911
+
+ Reviewed by Eric Carlson.
+
+ * pal/spi/cocoa/AVFoundationSPI.h:
+
2020-12-14 Russell Epstein <[email protected]>
Cherry-pick r270758. rdar://problem/72303521
Modified: branches/safari-611.1.9-branch/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h (270907 => 270908)
--- branches/safari-611.1.9-branch/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h 2020-12-16 21:07:59 UTC (rev 270907)
+++ branches/safari-611.1.9-branch/Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h 2020-12-16 21:20:59 UTC (rev 270908)
@@ -208,6 +208,19 @@
- (BOOL)willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:(NSArray<NSNumber *> *)displays;
NS_ASSUME_NONNULL_END
@end
+
+#if HAVE(AVCONTENTKEYREQUEST_PENDING_PROTECTION_STATUS)
+typedef NS_ENUM(NSInteger, AVExternalContentProtectionStatus) {
+ AVExternalContentProtectionStatusPending = 0,
+ AVExternalContentProtectionStatusSufficient = 1,
+ AVExternalContentProtectionStatusInsufficient = 2,
+};
+
+@interface AVContentKeyRequest (AVContentKeyRequest_PendingProtectionStatus)
+- (AVExternalContentProtectionStatus)externalContentProtectionStatus;
+@end
+#endif
+
#endif // HAVE(AVCONTENTKEYSESSION)
#if ENABLE(MEDIA_SOURCE) && !USE(APPLE_INTERNAL_SDK)
Modified: branches/safari-611.1.9-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h (270907 => 270908)
--- branches/safari-611.1.9-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2020-12-16 21:07:59 UTC (rev 270907)
+++ branches/safari-611.1.9-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2020-12-16 21:20:59 UTC (rev 270908)
@@ -194,7 +194,7 @@
void nextRequest();
AVContentKeyRequest* lastKeyRequest() const;
- bool keyRequestHasInsufficientProtectionForDisplayID(AVContentKeyRequest *, PlatformDisplayID) const;
+ Optional<CDMKeyStatus> protectionStatusForDisplayID(AVContentKeyRequest *, Optional<PlatformDisplayID>) const;
#if !RELEASE_LOG_DISABLED
WTF::Logger* loggerPtr() const { return m_logger.get(); };
Modified: branches/safari-611.1.9-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (270907 => 270908)
--- branches/safari-611.1.9-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2020-12-16 21:07:59 UTC (rev 270907)
+++ branches/safari-611.1.9-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2020-12-16 21:20:59 UTC (rev 270908)
@@ -1397,14 +1397,9 @@
if (oneRequest.get().error.code == SecurityLevelError)
status = CDMKeyStatus::OutputRestricted;
- // Only use the non-request-specific "outputObscuredDueToInsufficientExternalProtection" status if
- // AVContentKeyRequests do not support the finer grained "-willOutputBeObscured..." API.
- if (m_outputObscured && ![oneRequest respondsToSelector:@selector(willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:)])
- status = CDMKeyStatus::OutputRestricted;
+ if (auto protectionStatus = protectionStatusForDisplayID(oneRequest.get(), *displayID))
+ status = *protectionStatus;
- if (displayID && keyRequestHasInsufficientProtectionForDisplayID(oneRequest.get(), *displayID))
- status = CDMKeyStatus::OutputRestricted;
-
for (auto& keyID : keyIDs)
keyStatuses.append({ WTFMove(keyID), status });
}
@@ -1434,14 +1429,17 @@
updateProtectionStatusForDisplayID(m_client->displayID());
}
-bool CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID(AVContentKeyRequest *request, PlatformDisplayID displayID) const
+Optional<CDMKeyStatus> CDMInstanceSessionFairPlayStreamingAVFObjC::protectionStatusForDisplayID(AVContentKeyRequest *request, Optional<PlatformDisplayID> displayID) const
{
- // willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays will always return "YES" prior to
- // receiving a response.
- if (request.status != AVContentKeyRequestStatusReceivedResponse && request.status != AVContentKeyRequestStatusRenewed) {
- ALWAYS_LOG_IF_POSSIBLE(LOGIDENTIFIER, "request has insufficient status ", (int)request.status);
- return false;
+#if HAVE(AVCONTENTKEYREQUEST_PENDING_PROTECTION_STATUS)
+ if ([request respondsToSelector:@selector(externalContentProtectionStatus)]) {
+ switch ([request externalContentProtectionStatus]) {
+ case AVExternalContentProtectionStatusPending: return CDMKeyStatus::StatusPending;
+ case AVExternalContentProtectionStatusSufficient: return CDMKeyStatus::Usable;
+ case AVExternalContentProtectionStatusInsufficient: return CDMKeyStatus::OutputRestricted;
+ }
}
+#endif
// FIXME: AVFoundation requires a connection to the WindowServer in order to query the HDCP status of individual
// displays. Passing in an empty NSArray will cause AVFoundation to fall back to a "minimum supported HDCP level"
@@ -1450,11 +1448,25 @@
// WebProcess.
UNUSED_PARAM(displayID);
if ([request respondsToSelector:@selector(willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:)]) {
+
+ // willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays will always return "YES" prior to
+ // receiving a response.
+ if (request.status != AVContentKeyRequestStatusReceivedResponse && request.status != AVContentKeyRequestStatusRenewed) {
+ ALWAYS_LOG_IF_POSSIBLE(LOGIDENTIFIER, "request has insufficient status ", (int)request.status);
+ return WTF::nullopt;
+ }
+
auto obscured = [request willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:@[ ]];
ALWAYS_LOG_IF_POSSIBLE(LOGIDENTIFIER, "request { ", keyIDsForRequest(request), " } willOutputBeObscured...forDisplays:[ nil ] = ", obscured ? "true" : "false");
- return obscured;
+ return obscured ? CDMKeyStatus::OutputRestricted : CDMKeyStatus::Usable;
}
- return false;
+
+ // Only use the non-request-specific "outputObscuredDueToInsufficientExternalProtection" status if
+ // AVContentKeyRequests do not support the finer grained "-willOutputBeObscured..." API.
+ if (m_outputObscured)
+ return CDMKeyStatus::OutputRestricted;
+
+ return WTF::nullopt;
};