Title: [175284] trunk/Source/WebCore
Revision
175284
Author
[email protected]
Date
2014-10-28 16:51:45 -0700 (Tue, 28 Oct 2014)

Log Message

[EME][Mac] Adopt new AVStreamSession API: pass storageDirectoryAtURL at creation-time
https://bugs.webkit.org/show_bug.cgi?id=138149

Reviewed by Brent Fulgham.

AVStreamSession now requires its storage location at creation-time, rather than post-creation. This requires
us to move storage location code from CDMSessionMediaSourceAVFObjC to MediaPlayerPrivateMediaSourceAVFObjC.

* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]): Renamed.
(WebCore::CDMSessionMediaSourceAVFObjC::update):
(WebCore::sessionStorageDirectory): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::sessionStorageDirectory):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (175283 => 175284)


--- trunk/Source/WebCore/ChangeLog	2014-10-28 23:50:36 UTC (rev 175283)
+++ trunk/Source/WebCore/ChangeLog	2014-10-28 23:51:45 UTC (rev 175284)
@@ -1,3 +1,21 @@
+2014-10-28  Jer Noble  <[email protected]>
+
+        [EME][Mac] Adopt new AVStreamSession API: pass storageDirectoryAtURL at creation-time
+        https://bugs.webkit.org/show_bug.cgi?id=138149
+
+        Reviewed by Brent Fulgham.
+
+        AVStreamSession now requires its storage location at creation-time, rather than post-creation. This requires
+        us to move storage location code from CDMSessionMediaSourceAVFObjC to MediaPlayerPrivateMediaSourceAVFObjC.
+
+        * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
+        (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]): Renamed.
+        (WebCore::CDMSessionMediaSourceAVFObjC::update):
+        (WebCore::sessionStorageDirectory): Deleted.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::sessionStorageDirectory):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession):
+
 2014-10-28  Geoffrey Garen  <[email protected]>
 
         All networking crashes on Mac 32bit

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-10-28 23:50:36 UTC (rev 175283)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm	2014-10-28 23:51:45 UTC (rev 175284)
@@ -55,7 +55,6 @@
 @end
 
 @interface AVStreamSession : NSObject
-- (BOOL)setStorageDirectoryAtURL:(NSURL *)storageURL appIdentifier:(NSData *)appIdentifier error:(NSError **)outError;
 - (void)addStreamDataParser:(AVStreamDataParser *)streamDataParser;
 - (void)removeStreamDataParser:(AVStreamDataParser *)streamDataParser;
 - (void)expire;
@@ -175,22 +174,6 @@
     return !literal[length];
 }
 
-static const String& sessionStorageDirectory()
-{
-    static NeverDestroyed<String> sessionDirectoryPath;
-
-    if (sessionDirectoryPath.get().isEmpty()) {
-        char cacheDirectoryPath[PATH_MAX];
-        if (!confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectoryPath, PATH_MAX))
-            return WTF::emptyString();
-
-        sessionDirectoryPath.get().append(String(cacheDirectoryPath, strlen(cacheDirectoryPath)));
-        sessionDirectoryPath.get().append(ASCIILiteral("AVStreamSession/"));
-    }
-
-    return sessionDirectoryPath.get();
-}
-
 bool CDMSessionMediaSourceAVFObjC::update(Uint8Array* key, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, unsigned long& systemCode)
 {
     if (m_mode == KeyRelease)
@@ -227,12 +210,6 @@
 
     if (shouldGenerateKeyRequest) {
         RetainPtr<NSData> certificateData = adoptNS([[NSData alloc] initWithBytes:m_certificate->data() length:m_certificate->length()]);
-        if (m_streamSession && [m_streamSession respondsToSelector:@selector(setStorageDirectoryAtURL:storageURL:appIdentifier:error:)]) {
-            [m_streamSession setStorageDirectoryAtURL:[NSURL fileURLWithPath:sessionStorageDirectory()] appIdentifier:certificateData.get() error:nil];
-            for (auto& sourceBuffer : m_sourceBuffers)
-                [m_streamSession addStreamDataParser:sourceBuffer->parser()];
-            LOG(Media, "CDMSessionMediaSourceAVFObjC::update(%p) - created stream session %p", this, m_streamSession.get());
-        }
 
         if (m_sourceBuffers.isEmpty())
             return true;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (175283 => 175284)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2014-10-28 23:50:36 UTC (rev 175283)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2014-10-28 23:51:45 UTC (rev 175284)
@@ -116,6 +116,13 @@
 - (void)removeTimeObserver:(id)observer;
 @end
 
+#pragma mark - 
+#pragma mark AVStreamSession
+
+@interface AVStreamSession : NSObject
+- (instancetype)initWithStorageDirectoryAtURL:(NSURL *)storageDirectory;
+@end
+
 namespace WebCore {
 
 #pragma mark -
@@ -667,10 +674,29 @@
 }
 
 #if ENABLE(ENCRYPTED_MEDIA_V2)
+static const String& sessionStorageDirectory()
+{
+    static NeverDestroyed<String> sessionDirectoryPath;
+
+    if (sessionDirectoryPath.get().isEmpty()) {
+        char cacheDirectoryPath[PATH_MAX];
+        if (!confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectoryPath, PATH_MAX))
+            return WTF::emptyString();
+
+        sessionDirectoryPath.get().append(String(cacheDirectoryPath, strlen(cacheDirectoryPath)));
+        sessionDirectoryPath.get().append(ASCIILiteral("AVStreamSession/"));
+    }
+    
+    return sessionDirectoryPath.get();
+}
+
 AVStreamSession* MediaPlayerPrivateMediaSourceAVFObjC::streamSession()
 {
+    if (!getAVStreamSessionClass() || ![getAVStreamSessionClass() instancesRespondToSelector:@selector(initWithStorageDirectoryAtURL:)])
+        return nil;
+
     if (!m_streamSession)
-        m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] init]);
+        m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:sessionStorageDirectory()]]);
     return m_streamSession.get();
 }
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (175283 => 175284)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-10-28 23:50:36 UTC (rev 175283)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-10-28 23:51:45 UTC (rev 175284)
@@ -278,7 +278,7 @@
     });
 }
 
-- (void)streamParserWillProvideContentKeyRequestInitializationData:(AVStreamDataParser *)streamDataParser forTrackID:(CMPersistentTrackID)trackID
+- (void)streamDataParserWillProvideContentKeyRequestInitializationData:(AVStreamDataParser *)streamDataParser forTrackID:(CMPersistentTrackID)trackID
 {
 #if ASSERT_DISABLED
     UNUSED_PARAM(streamDataParser);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to