Title: [266202] branches/safari-610-branch/Source/WebCore
Revision
266202
Author
[email protected]
Date
2020-08-26 16:38:04 -0700 (Wed, 26 Aug 2020)

Log Message

Cherry-pick r266176. rdar://problem/67836292

    [Mac,EME] Netflix.com shows HDCP error for all streams
    https://bugs.webkit.org/show_bug.cgi?id=215825

    Reviewed by Eric Carlson.

    New API added to AVContentKeySession hits a sandbox restriction when run in the WebContent process, and the default
    behavior when an error checking HDCP status is to report that the output is restricted, regardless of the displays
    actual capabilities. To work around this behavior for now, pass in an empty displayID array, rather than the actual
    displayID. This causes AVFoundation to do a "lowest common level of support" rather than a specific display check.
    The upside is that this call no longer requires a connection to the WindowServer. The downside is that the
    AVContentKeyRequest will report that its output is restricted if any non-HDCP compliant display is attached.

    * WebCore.xcodeproj/project.pbxproj:
    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const):
    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266176 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (266201 => 266202)


--- branches/safari-610-branch/Source/WebCore/ChangeLog	2020-08-26 23:21:13 UTC (rev 266201)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog	2020-08-26 23:38:04 UTC (rev 266202)
@@ -1,3 +1,50 @@
+2020-08-26  Alan Coon  <[email protected]>
+
+        Cherry-pick r266176. rdar://problem/67836292
+
+    [Mac,EME] Netflix.com shows HDCP error for all streams
+    https://bugs.webkit.org/show_bug.cgi?id=215825
+    
+    Reviewed by Eric Carlson.
+    
+    New API added to AVContentKeySession hits a sandbox restriction when run in the WebContent process, and the default
+    behavior when an error checking HDCP status is to report that the output is restricted, regardless of the displays
+    actual capabilities. To work around this behavior for now, pass in an empty displayID array, rather than the actual
+    displayID. This causes AVFoundation to do a "lowest common level of support" rather than a specific display check.
+    The upside is that this call no longer requires a connection to the WindowServer. The downside is that the
+    AVContentKeyRequest will report that its output is restricted if any non-HDCP compliant display is attached.
+    
+    * WebCore.xcodeproj/project.pbxproj:
+    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
+    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const):
+    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-08-26  Jer Noble  <[email protected]>
+
+            [Mac,EME] Netflix.com shows HDCP error for all streams
+            https://bugs.webkit.org/show_bug.cgi?id=215825
+
+            Reviewed by Eric Carlson.
+
+            New API added to AVContentKeySession hits a sandbox restriction when run in the WebContent process, and the default
+            behavior when an error checking HDCP status is to report that the output is restricted, regardless of the displays
+            actual capabilities. To work around this behavior for now, pass in an empty displayID array, rather than the actual
+            displayID. This causes AVFoundation to do a "lowest common level of support" rather than a specific display check.
+            The upside is that this call no longer requires a connection to the WindowServer. The downside is that the
+            AVContentKeyRequest will report that its output is restricted if any non-HDCP compliant display is attached.
+
+            * WebCore.xcodeproj/project.pbxproj:
+            * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+            * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses const):
+            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID const):
+            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID):
+
 2020-08-21  Simon Fraser  <[email protected]>
 
         Add some FIXMEs in the EventHandler wheel event handling code for all the things that are wrong

Modified: branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h (266201 => 266202)


--- branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h	2020-08-26 23:21:13 UTC (rev 266201)
+++ branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h	2020-08-26 23:38:04 UTC (rev 266202)
@@ -190,10 +190,12 @@
     bool ensureSessionOrGroup();
     bool isLicenseTypeSupported(LicenseType) const;
 
-    KeyStatusVector keyStatuses() const;
+    KeyStatusVector keyStatuses(Optional<PlatformDisplayID> = WTF::nullopt) const;
     void nextRequest();
     AVContentKeyRequest* lastKeyRequest() const;
 
+    bool keyRequestHasInsufficientProtectionForDisplayID(AVContentKeyRequest *, PlatformDisplayID) const;
+
 #if !RELEASE_LOG_DISABLED
     WTF::Logger* loggerPtr() const { return m_logger.get(); };
     const void* logIdentifier() const { return m_logIdentifier; }

Modified: branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (266201 => 266202)


--- branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2020-08-26 23:21:13 UTC (rev 266201)
+++ branches/safari-610-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2020-08-26 23:38:04 UTC (rev 266202)
@@ -1340,10 +1340,13 @@
     }
 }
 
-CDMInstanceSession::KeyStatusVector CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses() const
+CDMInstanceSession::KeyStatusVector CDMInstanceSessionFairPlayStreamingAVFObjC::keyStatuses(Optional<PlatformDisplayID> displayID) const
 {
     KeyStatusVector keyStatuses;
 
+    if (!displayID && m_client)
+        displayID = m_client->displayID();
+
     for (auto& request : m_requests) {
         for (auto& oneRequest : request.requests) {
             auto keyIDs = keyIDsForRequest(oneRequest.get());
@@ -1351,6 +1354,9 @@
             if (m_outputObscured || oneRequest.get().error.code == SecurityLevelError)
                 status = CDMKeyStatus::OutputRestricted;
 
+            if (displayID && keyRequestHasInsufficientProtectionForDisplayID(oneRequest.get(), *displayID))
+                status = CDMKeyStatus::OutputRestricted;
+
             for (auto& keyID : keyIDs)
                 keyStatuses.append({ WTFMove(keyID), status });
         }
@@ -1379,21 +1385,35 @@
     updateProtectionStatusForDisplayID(m_client->displayID());
 }
 
+bool CDMInstanceSessionFairPlayStreamingAVFObjC::keyRequestHasInsufficientProtectionForDisplayID(AVContentKeyRequest *request, 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;
+    }
+
+    // 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"
+    // across all displays. Replace the below with explicit APIs to query the per-display HDCP status in the UIProcess
+    // and to query the HDCP level required by each AVContentKeyRequest, and do the comparison between the two in the
+    // WebProcess.
+    UNUSED_PARAM(displayID);
+    if ([request respondsToSelector:@selector(willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:)]) {
+        auto obscured = [request willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:@[ ]];
+        ALWAYS_LOG_IF_POSSIBLE(LOGIDENTIFIER, "request willOutputBeObscured...forDisplays:[ nil ] = ", obscured ? "true" : "false");
+        return obscured;
+    }
+    return false;
+};
+
+
 void CDMInstanceSessionFairPlayStreamingAVFObjC::updateProtectionStatusForDisplayID(PlatformDisplayID displayID)
 {
-    if (m_requests.isEmpty())
+    if (m_requests.isEmpty() || !m_client)
         return;
-
-    auto keyRequestHasInsufficientProtectionForDisplayID = [displayID] (auto& request) -> bool {
-        if ([request respondsToSelector:@selector(willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:)])
-            return [request willOutputBeObscuredDueToInsufficientExternalProtectionForDisplays:@[ @(displayID) ]];
-        return false;
-    };
-
-    bool outputWillBeObscured = WTF::anyOf(m_requests, [&](Request& request) {
-        return WTF::anyOf(request.requests, keyRequestHasInsufficientProtectionForDisplayID);
-    });
-    outputObscuredDueToInsufficientExternalProtectionChanged(outputWillBeObscured);
+    m_client->updateKeyStatuses(keyStatuses(displayID));
 }
 
 bool CDMInstanceSessionFairPlayStreamingAVFObjC::ensureSessionOrGroup()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to