Title: [241098] branches/safari-607-branch/Source/WebCore
Revision
241098
Author
[email protected]
Date
2019-02-06 14:18:27 -0800 (Wed, 06 Feb 2019)

Log Message

Cherry-pick r240746. rdar://problem/47774550

    [Cocoa][EME] persistent-usage-record data not issued after MediaKeySession.remove()
    https://bugs.webkit.org/show_bug.cgi?id=193984

    Reviewed by Eric Carlson.

    MediaKeySession.sessionId is empty during the CDMInstance->requestLicense success callback handler. The
    KVO notification that AVContentKeySession.contentProtectionSessionIdentifier changed isn't called until
    after the -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:]
    completion handler is called.

    Explicitly ask for the -contentProtectionSessionIdentifier inside that handler, and just in case the sessionID
    changes after that, add a new client callback method to notify the MediaKeySession that the ID has changed.

    * Modules/encryptedmedia/MediaKeySession.cpp:
    (WebCore::MediaKeySession::sessionIdChanged):
    * Modules/encryptedmedia/MediaKeySession.h:
    * platform/encryptedmedia/CDMInstanceSession.h:
    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest):

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

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (241097 => 241098)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-06 22:18:24 UTC (rev 241097)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-06 22:18:27 UTC (rev 241098)
@@ -1,3 +1,54 @@
+2019-02-06  Alan Coon  <[email protected]>
+
+        Cherry-pick r240746. rdar://problem/47774550
+
+    [Cocoa][EME] persistent-usage-record data not issued after MediaKeySession.remove()
+    https://bugs.webkit.org/show_bug.cgi?id=193984
+    
+    Reviewed by Eric Carlson.
+    
+    MediaKeySession.sessionId is empty during the CDMInstance->requestLicense success callback handler. The
+    KVO notification that AVContentKeySession.contentProtectionSessionIdentifier changed isn't called until
+    after the -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:]
+    completion handler is called.
+    
+    Explicitly ask for the -contentProtectionSessionIdentifier inside that handler, and just in case the sessionID
+    changes after that, add a new client callback method to notify the MediaKeySession that the ID has changed.
+    
+    * Modules/encryptedmedia/MediaKeySession.cpp:
+    (WebCore::MediaKeySession::sessionIdChanged):
+    * Modules/encryptedmedia/MediaKeySession.h:
+    * platform/encryptedmedia/CDMInstanceSession.h:
+    * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
+    (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-30  Jer Noble  <[email protected]>
+
+            [Cocoa][EME] persistent-usage-record data not issued after MediaKeySession.remove()
+            https://bugs.webkit.org/show_bug.cgi?id=193984
+
+            Reviewed by Eric Carlson.
+
+            MediaKeySession.sessionId is empty during the CDMInstance->requestLicense success callback handler. The
+            KVO notification that AVContentKeySession.contentProtectionSessionIdentifier changed isn't called until
+            after the -[AVContentKeyRequest makeStreamingContentKeyRequestDataForApp:contentIdentifier:options:completionHandler:]
+            completion handler is called.
+
+            Explicitly ask for the -contentProtectionSessionIdentifier inside that handler, and just in case the sessionID
+            changes after that, add a new client callback method to notify the MediaKeySession that the ID has changed.
+
+            * Modules/encryptedmedia/MediaKeySession.cpp:
+            (WebCore::MediaKeySession::sessionIdChanged):
+            * Modules/encryptedmedia/MediaKeySession.h:
+            * platform/encryptedmedia/CDMInstanceSession.h:
+            * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
+            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::nextRequest):
+
 2019-02-05  Alan Coon  <[email protected]>
 
         Cherry-pick r239752. rdar://problem/47776478

Modified: branches/safari-607-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (241097 => 241098)


--- branches/safari-607-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp	2019-02-06 22:18:24 UTC (rev 241097)
+++ branches/safari-607-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp	2019-02-06 22:18:27 UTC (rev 241098)
@@ -671,6 +671,11 @@
     enqueueMessage(messageType, message);
 }
 
+void MediaKeySession::sessionIdChanged(const String& sessionId)
+{
+    m_sessionId = sessionId;
+}
+
 void MediaKeySession::updateExpiration(double)
 {
     notImplemented();

Modified: branches/safari-607-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (241097 => 241098)


--- branches/safari-607-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h	2019-02-06 22:18:24 UTC (rev 241097)
+++ branches/safari-607-branch/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h	2019-02-06 22:18:27 UTC (rev 241098)
@@ -87,6 +87,7 @@
     // CDMInstanceSessionClient
     void updateKeyStatuses(CDMInstanceSessionClient::KeyStatusVector&&) override;
     void sendMessage(CDMMessageType, Ref<SharedBuffer>&& message) final;
+    void sessionIdChanged(const String&) final;
 
     // EventTarget
     EventTargetInterface eventTargetInterface() const override { return MediaKeySessionEventTargetInterfaceType; }

Modified: branches/safari-607-branch/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h (241097 => 241098)


--- branches/safari-607-branch/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h	2019-02-06 22:18:24 UTC (rev 241097)
+++ branches/safari-607-branch/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h	2019-02-06 22:18:27 UTC (rev 241098)
@@ -47,6 +47,7 @@
     using KeyStatusVector = Vector<std::pair<Ref<SharedBuffer>, KeyStatus>>;
     virtual void updateKeyStatuses(KeyStatusVector&&) = 0;
     virtual void sendMessage(CDMMessageType, Ref<SharedBuffer>&& message) = 0;
+    virtual void sessionIdChanged(const String&) = 0;
 };
 
 class CDMInstanceSession : public RefCounted<CDMInstanceSession> {

Modified: branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (241097 => 241098)


--- branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2019-02-06 22:18:24 UTC (rev 241097)
+++ branches/safari-607-branch/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2019-02-06 22:18:27 UTC (rev 241098)
@@ -527,6 +527,8 @@
             if (!weakThis)
                 return;
 
+            sessionIdentifierChanged(m_session.get().contentProtectionSessionIdentifier);
+
             if (error && m_requestLicenseCallback)
                 m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed);
             else if (m_requestLicenseCallback)
@@ -630,13 +632,15 @@
 
 void CDMInstanceSessionFairPlayStreamingAVFObjC::sessionIdentifierChanged(NSData *sessionIdentifier)
 {
-    if (!sessionIdentifier) {
-        m_sessionId = emptyString();
+    String sessionId = emptyString();
+    if (sessionIdentifier)
+        sessionId = adoptNS([[NSString alloc] initWithData:sessionIdentifier encoding:NSUTF8StringEncoding]).get();
+
+    if (m_sessionId == sessionId)
         return;
-    }
 
-    auto sessionIdentifierString = adoptNS([[NSString alloc] initWithData:sessionIdentifier encoding:NSUTF8StringEncoding]);
-    m_sessionId = sessionIdentifierString.get();
+    m_sessionId = sessionId;
+    m_client->sessionIdChanged(m_sessionId);
 }
 
 static auto requestStatusToCDMStatus(AVContentKeyRequestStatus status)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to