Changeset 148064 in webkit
- Timestamp:
- Apr 9, 2013 4:52:23 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148063 r148064 1 2013-04-09 Jer Noble <jer.noble@apple.com> 2 3 hang in mediaSelectionGroupForMediaCharacteristic 4 https://bugs.webkit.org/show_bug.cgi?id=114054 5 6 Reviewed by Eric Carlson. 7 8 No new tests; Fixes sporadic hangs in media/ tests. 9 10 -[AVURLAsset mediaSelectionGroupForMediaCharacteristic:] can deadlock in certain situations: When AVURLAsset 11 posts a synchronous AVAssetResourceLoader notification to the main thread, calling -mediaSelectionGroupForMediaCharacteristic: 12 on the main thread requires IO to occur if the media characteristics are not yet loaded. Instead of blocking, 13 bail out early if the media characteristics are not yet known. 14 15 Add a new method, safeMediaSelectionGroupForLegibleMedia(), which first checks selection group availability 16 before calling mediaSelectionGroupForMediaCharacteristic:. 17 18 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: 19 (MediaPlayerPrivateAVFoundationObjC): 20 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 21 (WebCore::MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForLegibleMedia): Added. 22 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Use new safe method. 23 (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Ditto. 24 (WebCore::MediaPlayerPrivateAVFoundationObjC::processTextTracks): Ditto. 25 (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTrack): Ditto. 26 1 27 2013-04-09 Chris Fleizach <cfleizach@apple.com> 2 28 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
r147675 r148064 33 33 34 34 OBJC_CLASS AVURLAsset; 35 OBJC_CLASS AVMediaSelectionGroup; 35 36 OBJC_CLASS AVPlayer; 36 37 OBJC_CLASS AVPlayerItem; … … 167 168 void processTextTracks(); 168 169 void clearTextTracks(); 170 AVMediaSelectionGroup* safeMediaSelectionGroupForLegibleMedia(); 169 171 #endif 170 172 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r148050 r148064 467 467 // We enabled automatic media selection because we want alternate audio tracks to be enabled/disabled automatically, 468 468 // but set the selected legible track to nil so text tracks will not be automatically configured. 469 [m_avPlayerItem.get() selectMediaOption:nil inMediaSelectionGroup: [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]];469 [m_avPlayerItem.get() selectMediaOption:nil inMediaSelectionGroup:safeMediaSelectionGroupForLegibleMedia()]; 470 470 471 471 [m_legibleOutput.get() setDelegate:m_objcObserver.get() queue:dispatch_get_main_queue()]; … … 986 986 #if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT) 987 987 if (!hasCaptions && m_legibleOutput) { 988 AVMediaSelectionGroupType *legibleGroup = [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];988 AVMediaSelectionGroupType *legibleGroup = safeMediaSelectionGroupForLegibleMedia(); 989 989 hasCaptions = [[AVMediaSelectionGroup playableMediaSelectionOptionsFromArray:[legibleGroup options]] count]; 990 990 } … … 1297 1297 } 1298 1298 1299 AVMediaSelectionGroupType* MediaPlayerPrivateAVFoundationObjC::safeMediaSelectionGroupForLegibleMedia() 1300 { 1301 if (!m_avAsset) 1302 return nil; 1303 1304 if ([m_avAsset.get() statusOfValueForKey:@"availableMediaCharacteristicsWithMediaSelectionOptions" error:NULL] != AVKeyValueStatusLoaded) 1305 return nil; 1306 1307 return [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]; 1308 } 1309 1299 1310 void MediaPlayerPrivateAVFoundationObjC::processTextTracks() 1300 1311 { 1301 AVMediaSelectionGroupType *legibleGroup = [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];1312 AVMediaSelectionGroupType *legibleGroup = safeMediaSelectionGroupForLegibleMedia(); 1302 1313 if (!legibleGroup) { 1303 1314 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::processTextTracks(%p) - nil mediaSelectionGroup", this); … … 1369 1380 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setCurrentTrack(%p) - selecting media option %p, language = %s", this, mediaSelectionOption, [[[mediaSelectionOption locale] localeIdentifier] UTF8String]); 1370 1381 1371 [m_avPlayerItem.get() selectMediaOption:mediaSelectionOption inMediaSelectionGroup: [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]];1382 [m_avPlayerItem.get() selectMediaOption:mediaSelectionOption inMediaSelectionGroup:safeMediaSelectionGroupForLegibleMedia()]; 1372 1383 m_currentTrack = trackPrivate; 1373 1384 }
Note: See TracChangeset
for help on using the changeset viewer.