Title: [240746] trunk/Source/WebCore
- Revision
- 240746
- Author
- [email protected]
- Date
- 2019-01-30 17:52:55 -0800 (Wed, 30 Jan 2019)
Log Message
[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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (240745 => 240746)
--- trunk/Source/WebCore/ChangeLog 2019-01-31 01:50:45 UTC (rev 240745)
+++ trunk/Source/WebCore/ChangeLog 2019-01-31 01:52:55 UTC (rev 240746)
@@ -1,3 +1,26 @@
+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-01-30 Keith Rollin <[email protected]>
FloatWithRect has invalid and inaccessible default constructor
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (240745 => 240746)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2019-01-31 01:50:45 UTC (rev 240745)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2019-01-31 01:52:55 UTC (rev 240746)
@@ -671,6 +671,11 @@
enqueueMessage(messageType, message);
}
+void MediaKeySession::sessionIdChanged(const String& sessionId)
+{
+ m_sessionId = sessionId;
+}
+
void MediaKeySession::updateExpiration(double)
{
notImplemented();
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h (240745 => 240746)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2019-01-31 01:50:45 UTC (rev 240745)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h 2019-01-31 01:52:55 UTC (rev 240746)
@@ -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: trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h (240745 => 240746)
--- trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h 2019-01-31 01:50:45 UTC (rev 240745)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h 2019-01-31 01:52:55 UTC (rev 240746)
@@ -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: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (240745 => 240746)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2019-01-31 01:50:45 UTC (rev 240745)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2019-01-31 01:52:55 UTC (rev 240746)
@@ -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