Title: [172651] trunk/Source/WebCore
Revision
172651
Author
[email protected]
Date
2014-08-15 14:14:14 -0700 (Fri, 15 Aug 2014)

Log Message

[EME][Mac] Adopt AVStreamSession.
https://bugs.webkit.org/show_bug.cgi?id=135983

Reviewed by Eric Carlson.

Add AVStreamDataParsers to a new AVStreamSession instance, and expire that session when asked to release
the session's keys.

* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC):
(WebCore::CDMSessionMediaSourceAVFObjC::releaseKeys):
(WebCore::CDMSessionMediaSourceAVFObjC::update):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172650 => 172651)


--- trunk/Source/WebCore/ChangeLog	2014-08-15 21:12:06 UTC (rev 172650)
+++ trunk/Source/WebCore/ChangeLog	2014-08-15 21:14:14 UTC (rev 172651)
@@ -1,3 +1,19 @@
+2014-08-15  Jer Noble  <[email protected]>
+
+        [EME][Mac] Adopt AVStreamSession.
+        https://bugs.webkit.org/show_bug.cgi?id=135983
+
+        Reviewed by Eric Carlson.
+
+        Add AVStreamDataParsers to a new AVStreamSession instance, and expire that session when asked to release
+        the session's keys.
+
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+        (WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC):
+        (WebCore::CDMSessionMediaSourceAVFObjC::releaseKeys):
+        (WebCore::CDMSessionMediaSourceAVFObjC::update):
+
 2014-08-15  Wenson Hsieh  <[email protected]>
 
         Implement snapping behavior for iOS

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h (172650 => 172651)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h	2014-08-15 21:12:06 UTC (rev 172650)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h	2014-08-15 21:14:14 UTC (rev 172651)
@@ -33,6 +33,8 @@
 
 #if ENABLE(ENCRYPTED_MEDIA_V2) && ENABLE(MEDIA_SOURCE)
 
+OBJC_CLASS AVStreamSession;
+
 namespace WebCore {
 
 class CDMSessionMediaSourceAVFObjC : public CDMSession, public SourceBufferPrivateAVFObjCErrorClient {
@@ -52,6 +54,7 @@
 protected:
     RefPtr<SourceBufferPrivateAVFObjC> m_parent;
     CDMSessionClient* m_client;
+    RetainPtr<AVStreamSession> m_streamSession;
     RefPtr<Uint8Array> m_initData;
     RefPtr<Uint8Array> m_certificate;
     String m_sessionId;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm (172650 => 172651)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-08-15 21:12:06 UTC (rev 172650)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-08-15 21:14:14 UTC (rev 172651)
@@ -42,7 +42,7 @@
 
 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
 SOFT_LINK_CLASS(AVFoundation, AVStreamDataParser);
-#define AVAssetResourceLoadingRequest getAVStreamDataParser()
+SOFT_LINK_CLASS_OPTIONAL(AVFoundation, AVStreamSession);
 
 @interface AVStreamDataParser : NSObject
 - (void)processContentKeyResponseData:(NSData *)contentKeyResponseData forTrackID:(CMPersistentTrackID)trackID;
@@ -51,6 +51,15 @@
 - (NSData *)streamingContentKeyRequestDataForApp:(NSData *)appIdentifier contentIdentifier:(NSData *)contentIdentifier trackID:(CMPersistentTrackID)trackID options:(NSDictionary *)options error:(NSError **)outError;
 @end
 
+@interface AVStreamSession : NSObject
+- (instancetype)initWithAppIdentifier:(NSData *)appIdentifier;
+- (void)addStreamDataParser:(AVStreamDataParser *)streamDataParser;
+- (void)removeStreamDataParser:(AVStreamDataParser *)streamDataParser;
+- (void)expire;
++ (NSArray *)pendingExpiredSessionReportsWithAppIdentifier:(NSData *)appIdentifier;
++ (void)removePendingExpiredSessionReports:(NSArray *)expiredSessionReports withAppIdentifier:(NSData *)appIdentifier;
+@end
+
 namespace WebCore {
 
 CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC(SourceBufferPrivateAVFObjC* parent)
@@ -64,6 +73,10 @@
 
 CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC()
 {
+    if (m_streamSession) {
+        [m_streamSession removeStreamDataParser:m_parent->parser()];
+        m_streamSession = nil;
+    }
     m_parent->unregisterForErrorNotifications(this);
     m_client = nullptr;
 }
@@ -90,7 +103,10 @@
 
 void CDMSessionMediaSourceAVFObjC::releaseKeys()
 {
-    LOG(Media, "CDMSessionMediaSourceAVFObjC::releaseKeys(%p)", this);
+    if (m_streamSession) {
+        LOG(Media, "CDMSessionMediaSourceAVFObjC::releaseKeys(%p) - expiring stream session", this);
+        [m_streamSession expire];
+    }
 }
 
 static bool isEqual(Uint8Array* data, const char* literal)
@@ -120,6 +136,12 @@
 
     if (shouldGenerateKeyRequest) {
         RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
+        if (getAVStreamSessionClass()) {
+            m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithAppIdentifier:certificateData.get()]);
+            [m_streamSession addStreamDataParser:m_parent->parser()];
+            LOG(Media, "CDMSessionMediaSourceAVFObjC::update(%p) - created stream session %p", this, m_streamSession.get());
+        }
+
         RetainPtr<NSData> initData = adoptNS([[NSData alloc] initWithBytes:m_initData->data() length:m_initData->length()]);
 
         NSError* error = nil;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to