Changeset 202678 in webkit
- Timestamp:
- Jun 30, 2016 7:26:14 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r202677 r202678 1 2016-06-30 Eric Carlson <eric.carlson@apple.com> 2 3 [Mac] Crash registering AVFoundation media engine 4 https://bugs.webkit.org/show_bug.cgi?id=159269 5 <rdar://problem/27017656> 6 7 Reviewed by Brent Fulgham. 8 9 * platform/graphics/MediaPlayer.cpp: 10 (WebCore::mediaEngineVectorLock): New, return the static Lock. 11 (WebCore::haveMediaEnginesVector): Wrap the naked bool. 12 (WebCore::buildMediaEnginesVector): Assert that the lock is locked. 13 (WebCore::installedMediaEngines): Hold the lock while checking/rebuilding the vector. 14 (WebCore::MediaPlayer::resetMediaEngines): Hold the lock while clearing the vector. 15 16 Use SOFT_LINK_CLASS_FOR_SOURCE instead of SOFT_LINK_CLASS because the former uses dispatch_once 17 to ensure that class loading is thread safe. 18 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 19 (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): 20 (WebCore::assetCacheForPath): 21 (WebCore::MediaPlayerPrivateAVFoundationObjC::originsInMediaCache): 22 (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache): 23 (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins): 24 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): 25 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): 26 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): 27 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): 28 (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput): 29 (WebCore::MediaPlayerPrivateAVFoundationObjC::createOpenGLVideoOutput): 30 (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange): 31 (WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange): 32 (-[WebCoreAVFPullDelegate setCallback:]): 33 (-[WebCoreAVFPullDelegate outputMediaDataWillChange:]): 34 (-[WebCoreAVFPullDelegate outputSequenceWasFlushed:]): 35 1 36 2016-06-30 Carlos Garcia Campos <cgarcia@igalia.com> 2 37 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r201474 r202678 179 179 static void addMediaEngine(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineOriginsInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForOrigins, MediaEngineSupportsKeySystem); 180 180 181 static bool haveMediaEnginesVector; 181 static Lock& mediaEngineVectorLock() 182 { 183 static NeverDestroyed<Lock> lock; 184 return lock; 185 } 186 187 static bool& haveMediaEnginesVector() 188 { 189 static bool haveVector; 190 return haveVector; 191 } 182 192 183 193 static Vector<MediaPlayerFactory>& mutableInstalledMediaEnginesVector() … … 189 199 static void buildMediaEnginesVector() 190 200 { 201 ASSERT(mediaEngineVectorLock().isLocked()); 202 191 203 #if USE(AVFOUNDATION) 192 204 if (Settings::isAVFoundationEnabled()) { … … 224 236 #endif 225 237 226 haveMediaEnginesVector = true;238 haveMediaEnginesVector() = true; 227 239 } 228 240 229 241 static const Vector<MediaPlayerFactory>& installedMediaEngines() 230 242 { 231 if (!haveMediaEnginesVector) 232 buildMediaEnginesVector(); 243 { 244 LockHolder lock(mediaEngineVectorLock()); 245 if (!haveMediaEnginesVector()) 246 buildMediaEnginesVector(); 247 } 248 233 249 return mutableInstalledMediaEnginesVector(); 234 250 } … … 1328 1344 void MediaPlayer::resetMediaEngines() 1329 1345 { 1346 LockHolder lock(mediaEngineVectorLock()); 1347 1330 1348 mutableInstalledMediaEnginesVector().clear(); 1331 haveMediaEnginesVector = false;1349 haveMediaEnginesVector() = false; 1332 1350 } 1333 1351 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r202546 r202678 143 143 typedef AVMediaSelectionGroup AVMediaSelectionGroupType; 144 144 typedef AVMediaSelectionOption AVMediaSelectionOptionType; 145 typedef AVAssetCache AVAssetCacheType; 145 146 146 147 #pragma mark - Soft Linking … … 153 154 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreImage) 154 155 155 SOFT_LINK_CLASS (AVFoundation, AVPlayer)156 SOFT_LINK_CLASS (AVFoundation, AVPlayerItem)157 SOFT_LINK_CLASS (AVFoundation, AVPlayerItemVideoOutput)158 SOFT_LINK_CLASS (AVFoundation, AVPlayerLayer)159 SOFT_LINK_CLASS (AVFoundation, AVURLAsset)160 SOFT_LINK_CLASS (AVFoundation, AVAssetImageGenerator)161 SOFT_LINK_CLASS (AVFoundation, AVMetadataItem)162 SOFT_LINK_CLASS (AVFoundation, AVAssetCache)156 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayer) 157 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayerItem) 158 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayerItemVideoOutput) 159 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVPlayerLayer) 160 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVURLAsset) 161 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVAssetImageGenerator) 162 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVMetadataItem) 163 SOFT_LINK_CLASS_FOR_SOURCE(WebCore, AVFoundation, AVAssetCache) 163 164 164 165 SOFT_LINK_CLASS(CoreImage, CIContext) … … 183 184 SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVURLAssetClientBundleIdentifierKey, NSString *) 184 185 185 #define AVPlayer getAVPlayerClass() 186 #define AVPlayerItem getAVPlayerItemClass() 187 #define AVPlayerLayer getAVPlayerLayerClass() 188 #define AVURLAsset getAVURLAssetClass() 189 #define AVAssetImageGenerator getAVAssetImageGeneratorClass() 190 #define AVMetadataItem getAVMetadataItemClass() 186 #define AVPlayer initAVPlayer() 187 #define AVPlayerItem initAVPlayerItem() 188 #define AVPlayerLayer initAVPlayerLayer() 189 #define AVURLAsset initAVURLAsset() 190 #define AVAssetImageGenerator initAVAssetImageGenerator() 191 #define AVPlayerItemVideoOutput initAVPlayerItemVideoOutput() 192 #define AVMetadataItem initAVMetadataItem() 193 #define AVAssetCache initAVAssetCache() 191 194 192 195 #define AVAudioTimePitchAlgorithmSpectral getAVAudioTimePitchAlgorithmSpectral() … … 433 436 } 434 437 435 static AVAssetCache *assetCacheForPath(const String& path)438 static AVAssetCacheType *assetCacheForPath(const String& path) 436 439 { 437 440 NSURL *assetCacheURL; … … 442 445 assetCacheURL = [NSURL fileURLWithPath:path isDirectory:YES]; 443 446 444 return [ getAVAssetCacheClass() assetCacheWithURL:assetCacheURL];447 return [initAVAssetCache() assetCacheWithURL:assetCacheURL]; 445 448 } 446 449 … … 468 471 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::clearMediaCache()"); 469 472 470 AVAssetCache * assetCache = assetCacheForPath(path);473 AVAssetCacheType* assetCache = assetCacheForPath(path); 471 474 472 475 for (NSString *key in [assetCache allKeys]) { … … 511 514 { 512 515 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins()"); 513 AVAssetCache * assetCache = assetCacheForPath(path);516 AVAssetCacheType* assetCache = assetCacheForPath(path); 514 517 for (NSString *key in [assetCache allKeys]) { 515 518 URL keyAsURL = URL(URL(), key); … … 731 734 return; 732 735 733 m_videoLayer = adoptNS([ allocAVPlayerLayerInstance()init]);736 m_videoLayer = adoptNS([[AVPlayerLayer alloc] init]); 734 737 [m_videoLayer setPlayer:m_avPlayer.get()]; 735 738 [m_videoLayer setBackgroundColor:cachedCGColor(Color::black)]; … … 977 980 978 981 NSURL *cocoaURL = canonicalURL(url); 979 m_avAsset = adoptNS([ allocAVURLAssetInstance()initWithURL:cocoaURL options:options.get()]);982 m_avAsset = adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:options.get()]); 980 983 981 984 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) … … 1027 1030 setDelayCallbacks(true); 1028 1031 1029 m_avPlayer = adoptNS([ allocAVPlayerInstance()init]);1032 m_avPlayer = adoptNS([[AVPlayer alloc] init]); 1030 1033 for (NSString *keyName in playerKVOProperties()) 1031 1034 [m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:keyName options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextPlayer]; … … 1073 1076 1074 1077 // Create the player item so we can load media data. 1075 m_avPlayerItem = adoptNS([ allocAVPlayerItemInstance()initWithAsset:m_avAsset.get()]);1078 m_avPlayerItem = adoptNS([[AVPlayerItem alloc] initWithAsset:m_avAsset.get()]); 1076 1079 1077 1080 [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(didEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:m_avPlayerItem.get()]; … … 1090 1093 1091 1094 RetainPtr<NSArray> subtypes = adoptNS([[NSArray alloc] initWithObjects:[NSNumber numberWithUnsignedInt:kCMSubtitleFormatType_WebVTT], nil]); 1092 m_legibleOutput = adoptNS([ allocAVPlayerItemLegibleOutputInstance()initWithMediaSubtypesForNativeRepresentation:subtypes.get()]);1095 m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:subtypes.get()]); 1093 1096 [m_legibleOutput.get() setSuppressesPlayerRendering:YES]; 1094 1097 … … 2285 2288 nil]; 2286 2289 #endif 2287 m_videoOutput = adoptNS([ allocAVPlayerItemVideoOutputInstance()initWithPixelBufferAttributes:attributes]);2290 m_videoOutput = adoptNS([[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:attributes]); 2288 2291 ASSERT(m_videoOutput); 2289 2292 … … 2409 2412 NSDictionary* attributes = @{(NSString *)kCVPixelBufferIOSurfaceOpenGLFBOCompatibilityKey: @YES}; 2410 2413 #endif 2411 m_openGLVideoOutput = adoptNS([ allocAVPlayerItemVideoOutputInstance()initWithPixelBufferAttributes:attributes]);2414 m_openGLVideoOutput = adoptNS([[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:attributes]); 2412 2415 ASSERT(m_openGLVideoOutput); 2413 2416 … … 2493 2496 } 2494 2497 2495 void MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange(AVPlayerItemVideoOutput *)2498 void MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange(AVPlayerItemVideoOutputType *) 2496 2499 { 2497 2500 dispatch_semaphore_signal(m_videoOutputSemaphore); … … 3601 3604 } 3602 3605 3603 - (void)outputMediaDataWillChange:(AVPlayerItemVideoOutput *)output3606 - (void)outputMediaDataWillChange:(AVPlayerItemVideoOutputType *)output 3604 3607 { 3605 3608 if (m_callback) … … 3607 3610 } 3608 3611 3609 - (void)outputSequenceWasFlushed:(AVPlayerItemVideoOutput *)output3612 - (void)outputSequenceWasFlushed:(AVPlayerItemVideoOutputType *)output 3610 3613 { 3611 3614 UNUSED_PARAM(output);
Note: See TracChangeset
for help on using the changeset viewer.