Ensure media cache directory is created before passing to AVURLAsset.
<rdar://51539885>
Created attachment 394089 [details] Patch
Comment on attachment 394089 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394089&action=review > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:850 > bool usePersistentCache = player()->shouldUsePersistentCache(); > [options setObject:@(!usePersistentCache) forKey:AVURLAssetUsesNoPersistentCacheKey]; > > - if (usePersistentCache) > - [options setObject:assetCacheForPath(player()->mediaCacheDirectory()) forKey:AVURLAssetCacheKey]; > + if (usePersistentCache) { > + auto mediaCacheDirectory = player()->mediaCacheDirectory(); > + if (FileSystem::fileIsDirectory(mediaCacheDirectory, ShouldFollowSymbolicLinks::Yes) || FileSystem::makeAllDirectories(mediaCacheDirectory)) > + [options setObject:assetCacheForPath(mediaCacheDirectory) forKey:AVURLAssetCacheKey]; > + else > + ASSERT_NOT_REACHED(); > + } As we discussed, 'usePersistentCache' should be false if 'player()->mediaCacheDirectory()' is empty
Created attachment 394095 [details] Patch
Comment on attachment 394095 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394095&action=review > Source/WebKitLegacy/mac/ChangeLog:9 > + directory by default; ensure that it's media cache directory is set during initialization. "it's" :-O > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:874 > [options setObject:@(!usePersistentCache) forKey:AVURLAssetUsesNoPersistentCacheKey]; > > - if (usePersistentCache) > - [options setObject:assetCacheForPath(player()->mediaCacheDirectory()) forKey:AVURLAssetCacheKey]; > + if (usePersistentCache) { > + if (auto* assetCache = ensureAssetCacheExistsForPath(player()->mediaCacheDirectory())) > + [options setObject:assetCache forKey:AVURLAssetCacheKey]; > + else Shouldn't we set AVURLAssetUsesNoPersistentCacheKey to NO if ensureAssetCacheExistsForPath() return nil?
Created attachment 394103 [details] Patch for landing
Committed r258795: <https://trac.webkit.org/changeset/258795> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394103 [details].