| Summary: | Ensure media cache directory is created before passing to AVURLAsset. | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Jer Noble <jer.noble> | ||||||||
| Component: | New Bugs | Assignee: | Jer Noble <jer.noble> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | eric.carlson, ews-watchlist, glenn, peng.liu6, philipj, sergio | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Jer Noble
2020-03-20 09:08:12 PDT
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]. |