Modified: trunk/Source/WebCore/ChangeLog (228822 => 228823)
--- trunk/Source/WebCore/ChangeLog 2018-02-20 17:52:34 UTC (rev 228822)
+++ trunk/Source/WebCore/ChangeLog 2018-02-20 18:14:32 UTC (rev 228823)
@@ -1,3 +1,20 @@
+2018-02-20 Jer Noble <[email protected]>
+
+ [EME] Adopt new AVContentKeySession success delegate callback
+ https://bugs.webkit.org/show_bug.cgi?id=182974
+ <rdar://problem/36079035>
+
+ Reviewed by Eric Carlson.
+
+ Store the updateLicenseCallback if the new protocol method is present and supported.
+
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequestDidSucceed:]):
+ (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
+ (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
+ (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
+
2018-02-19 Dean Jackson <[email protected]>
Handle all writing-modes in downcast
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h (228822 => 228823)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2018-02-20 17:52:34 UTC (rev 228822)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h 2018-02-20 18:14:32 UTC (rev 228823)
@@ -74,6 +74,7 @@
void didProvideRenewingRequest(AVContentKeyRequest *);
void didProvidePersistableRequest(AVContentKeyRequest *);
void didFailToProvideRequest(AVContentKeyRequest *, NSError *);
+ void requestDidSucceed(AVContentKeyRequest *);
bool shouldRetryRequestForReason(AVContentKeyRequest *, NSString *);
void sessionIdentifierChanged(NSData *);
void outputObscuredDueToInsufficientExternalProtectionChanged(bool);
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (228822 => 228823)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2018-02-20 17:52:34 UTC (rev 228822)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2018-02-20 18:14:32 UTC (rev 228823)
@@ -34,6 +34,7 @@
#import "SharedBuffer.h"
#import "TextDecoder.h"
#import <AVFoundation/AVContentKeySession.h>
+#import <objc/runtime.h>
#import <pal/spi/mac/AVFoundationSPI.h>
#import <wtf/SoftLinking.h>
#import <wtf/text/StringHash.h>
@@ -108,6 +109,13 @@
_parent->didFailToProvideRequest(keyRequest, err);
}
+- (void)contentKeySession:(AVContentKeySession *)session contentKeyRequestDidSucceed:(AVContentKeyRequest *)keyRequest
+{
+ UNUSED_PARAM(session);
+ if (_parent)
+ _parent->requestDidSucceed(keyRequest);
+}
+
- (BOOL)contentKeySession:(AVContentKeySession *)session shouldRetryContentKeyRequest:(AVContentKeyRequest *)keyRequest reason:(AVContentKeyRequestRetryReason)retryReason
{
UNUSED_PARAM(session);
@@ -309,10 +317,16 @@
[m_request processContentKeyResponse:[getAVContentKeyResponseClass() contentKeyResponseWithFairPlayStreamingKeyResponseData:responseData.createNSData().get()]];
// FIXME(rdar://problem/35592277): stash the callback and call it once AVContentKeyResponse supports a success callback.
- KeyStatusVector keyStatuses;
- keyStatuses.reserveInitialCapacity(1);
- keyStatuses.uncheckedAppend(std::make_pair(WTFMove(keyIDs.first()), KeyStatus::Usable));
- callback(false, std::make_optional(WTFMove(keyStatuses)), std::nullopt, std::nullopt, Succeeded);
+ struct objc_method_description method = protocol_getMethodDescription(@protocol(AVContentKeySessionDelegate), @selector(contentKeySession:contentKeyRequestDidSucceed:), NO, YES);
+ if (!method.name) {
+ KeyStatusVector keyStatuses;
+ keyStatuses.reserveInitialCapacity(1);
+ keyStatuses.uncheckedAppend(std::make_pair(WTFMove(keyIDs.first()), KeyStatus::Usable));
+ callback(false, std::make_optional(WTFMove(keyStatuses)), std::nullopt, std::nullopt, Succeeded);
+ return;
+ }
+
+ m_updateLicenseCallback = WTFMove(callback);
}
void CDMInstanceFairPlayStreamingAVFObjC::loadSession(LicenseType licenseType, const String& sessionId, const String& origin, LoadSessionCallback callback)
@@ -469,10 +483,23 @@
{
UNUSED_PARAM(request);
UNUSED_PARAM(error);
- if (m_requestLicenseCallback)
- m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed);
+ if (m_updateLicenseCallback)
+ m_updateLicenseCallback(false, std::nullopt, std::nullopt, std::nullopt, Failed);
}
+void CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed(AVContentKeyRequest *request)
+{
+ UNUSED_PARAM(request);
+ if (!m_updateLicenseCallback)
+ return;
+
+ Vector<Ref<SharedBuffer>> keyIDs = this->keyIDs();
+ KeyStatusVector keyStatuses;
+ keyStatuses.reserveInitialCapacity(1);
+ keyStatuses.uncheckedAppend(std::make_pair(WTFMove(keyIDs.first()), KeyStatus::Usable));
+ m_updateLicenseCallback(false, std::make_optional(WTFMove(keyStatuses)), std::nullopt, std::nullopt, Succeeded);
+}
+
bool CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason(AVContentKeyRequest *request, NSString *reason)
{
UNUSED_PARAM(request);