Changeset 201831 in webkit
- Timestamp:
- Jun 8, 2016 2:07:42 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201823 r201831 1 2016-06-08 Eric Carlson <eric.carlson@apple.com> 2 3 HTMLMediaElement.prototype.canPlayType accounting for 250-750ms first loading theverge.com 4 https://bugs.webkit.org/show_bug.cgi?id=158335 5 <rdar://problem/26615416> 6 7 Reviewed by Brent Fulgham. 8 9 * WebCore.xcodeproj/project.pbxproj: Add AVFoundationMIMETypeCache. 10 11 * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h: Added. 12 * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: Added. 13 (WebCore::AVFoundationMIMETypeCache::AVFoundationMIMETypeCache): 14 (WebCore::AVFoundationMIMETypeCache::loadTypes): 15 (WebCore::AVFoundationMIMETypeCache::types): 16 (WebCore::AVFoundationMIMETypeCache::singleton): 17 18 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 19 (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): Start MIME type loading. 20 (WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes): Use AVFoundationMIMETypeCache. 21 (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType): Ditto. 22 (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem): Ditto. 23 (WebCore::avfMIMETypes): Deleted. 24 25 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 26 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine): Start MIME type loading. 27 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isAvailable): Use AVFoundationMIMETypeCache. 28 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes): Ditto. 29 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): Ditto. 30 (WebCore::mimeTypeCache): Deleted. 31 1 32 2016-06-07 Ryosuke Niwa <rniwa@webkit.org> 2 33 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r201810 r201831 113 113 070F549E17F2402700169E04 /* AudioDestinationConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 070F549D17F2402700169E04 /* AudioDestinationConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 114 114 0711589117DF6F6600EDFE2B /* MediaStreamPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0711588F17DF633700EDFE2B /* MediaStreamPrivate.cpp */; }; 115 0719427F1D088F21002AA51D /* AVFoundationMIMETypeCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */; }; 115 116 071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */; }; 116 117 071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */ = {isa = PBXBuildFile; fileRef = 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 7722 7723 07C59B6617F784BA000FBCBB /* MediaSourceSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourceSettings.h; sourceTree = "<group>"; }; 7723 7724 07C59B6D17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStreamTrackCustom.cpp; sourceTree = "<group>"; }; 7725 07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVFoundationMIMETypeCache.mm; sourceTree = "<group>"; }; 7726 07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVFoundationMIMETypeCache.h; sourceTree = "<group>"; }; 7724 7727 07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCPeerConnectionCustom.cpp; sourceTree = "<group>"; }; 7725 7728 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; }; … … 23348 23351 CD54A760180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp */, 23349 23352 CD54A761180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.h */, 23353 07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */, 23354 07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */, 23350 23355 CDE595941BF166D100A1CBE8 /* CDMSessionAVContentKeySession.h */, 23351 23356 CDE595931BF166AD00A1CBE8 /* CDMSessionAVContentKeySession.mm */, … … 31488 31493 078E090717D14CEE00420AA1 /* RTCDTMFSender.cpp in Sources */, 31489 31494 073794FB19F5864E00E5A045 /* RTCDTMFSenderHandlerMock.cpp in Sources */, 31495 0719427F1D088F21002AA51D /* AVFoundationMIMETypeCache.mm in Sources */, 31490 31496 078E090817D14CEE00420AA1 /* RTCDTMFToneChangeEvent.cpp in Sources */, 31491 31497 078E090917D14CEE00420AA1 /* RTCIceCandidate.cpp in Sources */, -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r201661 r201831 29 29 #import "MediaPlayerPrivateAVFoundationObjC.h" 30 30 31 #import "AVFoundationMIMETypeCache.h" 31 32 #import "AVFoundationSPI.h" 32 33 #import "AVTrackPrivateAVFObjCImpl.h" … … 46 47 #import "InbandTextTrackPrivateAVFObjC.h" 47 48 #import "InbandTextTrackPrivateLegacyAVFObjC.h" 48 #import "OutOfBandTextTrackPrivateAVF.h"49 #import "URL.h"50 49 #import "Logging.h" 51 50 #import "MediaPlaybackTargetMac.h" … … 53 52 #import "MediaSelectionGroupAVFObjC.h" 54 53 #import "MediaTimeAVFoundation.h" 54 #import "OutOfBandTextTrackPrivateAVF.h" 55 55 #import "PixelBufferConformerCV.h" 56 56 #import "PlatformTimeRanges.h" … … 62 62 #import "TextTrackRepresentation.h" 63 63 #import "TextureCacheCV.h" 64 #import "URL.h" 64 65 #import "UUID.h" 65 66 #import "VideoTextureCopierCV.h" … … 424 425 void MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(MediaEngineRegistrar registrar) 425 426 { 426 if (isAvailable()) 427 registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateAVFoundationObjC>(player); }, 427 if (!isAvailable()) 428 return; 429 430 registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateAVFoundationObjC>(player); }, 428 431 getSupportedTypes, supportsType, originsInMediaCache, clearMediaCache, clearMediaCacheForOrigins, supportsKeySystem); 432 AVFoundationMIMETypeCache::singleton().loadTypes(); 429 433 } 430 434 … … 1611 1615 } 1612 1616 1613 static const HashSet<String, ASCIICaseInsensitiveHash>& avfMIMETypes()1614 {1615 static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> cache = []() {1616 HashSet<String, ASCIICaseInsensitiveHash> types;1617 for (NSString *type in [AVURLAsset audiovisualMIMETypes])1618 types.add(type);1619 return types;1620 }();1621 1622 return cache;1623 }1624 1625 1617 RetainPtr<CGImageRef> MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect(float time, const FloatRect& rect) 1626 1618 { … … 1647 1639 void MediaPlayerPrivateAVFoundationObjC::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>& supportedTypes) 1648 1640 { 1649 supportedTypes = avfMIMETypes(); 1641 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::getSupportedTypes"); 1642 supportedTypes = AVFoundationMIMETypeCache::singleton().types(); 1650 1643 } 1651 1644 … … 1694 1687 return MediaPlayer::IsNotSupported; 1695 1688 1696 if (!staticMIMETypeList().contains(parameters.type) && ! avfMIMETypes().contains(parameters.type))1689 if (!staticMIMETypeList().contains(parameters.type) && !AVFoundationMIMETypeCache::singleton().types().contains(parameters.type)) 1697 1690 return MediaPlayer::IsNotSupported; 1698 1691 … … 1720 1713 return false; 1721 1714 1722 if (!mimeType.isEmpty() && !staticMIMETypeList().contains(mimeType) && ! avfMIMETypes().contains(mimeType))1715 if (!mimeType.isEmpty() && !staticMIMETypeList().contains(mimeType) && !AVFoundationMIMETypeCache::singleton().types().contains(mimeType)) 1723 1716 return false; 1724 1717 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r201482 r201831 29 29 #if ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION) 30 30 31 #import "AVFoundationMIMETypeCache.h" 31 32 #import "CDMSessionAVStreamSession.h" 32 33 #import "CDMSessionMediaSourceAVFObjC.h" … … 203 204 void MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine(MediaEngineRegistrar registrar) 204 205 { 205 if (isAvailable()) 206 registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateMediaSourceAVFObjC>(player); }, getSupportedTypes, 207 supportsType, 0, 0, 0, 0); 206 if (!isAvailable()) 207 return; 208 209 registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateMediaSourceAVFObjC>(player); }, 210 getSupportedTypes, supportsType, 0, 0, 0, 0); 211 AVFoundationMIMETypeCache::singleton().loadTypes(); 208 212 } 209 213 … … 218 222 } 219 223 220 static const HashSet<String, ASCIICaseInsensitiveHash>& mimeTypeCache()221 {222 static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> cache;223 static bool typeListInitialized = false;224 225 if (typeListInitialized)226 return cache;227 typeListInitialized = true;228 229 NSArray *types = [getAVURLAssetClass() audiovisualMIMETypes];230 for (NSString *mimeType in types)231 cache.get().add(mimeType);232 233 return cache;234 }235 236 224 void MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>& types) 237 225 { 238 types = mimeTypeCache();226 types = AVFoundationMIMETypeCache::singleton().types(); 239 227 } 240 228 … … 249 237 #endif 250 238 251 if (parameters.type.isEmpty() || ! mimeTypeCache().contains(parameters.type))239 if (parameters.type.isEmpty() || !AVFoundationMIMETypeCache::singleton().types().contains(parameters.type)) 252 240 return MediaPlayer::IsNotSupported; 253 241
Note: See TracChangeset
for help on using the changeset viewer.