Title: [142334] trunk/Source/WebCore
- Revision
- 142334
- Author
- [email protected]
- Date
- 2013-02-08 17:32:16 -0800 (Fri, 08 Feb 2013)
Log Message
[Mac] In-band closed caption tracks are not always initialized correctly
https://bugs.webkit.org/show_bug.cgi?id=109323
Reviewed by Dean Jackson.
No new tests, makes existing tests less flakey.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Create and configure legible output
here instad of in tracksChanged.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible): Do nothing in a build with
in-band track support.
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Move legible output creation to
createAVPlayerItem, don't set look at track media type to see if the movie has captions
when we have support for in-band captions.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (142333 => 142334)
--- trunk/Source/WebCore/ChangeLog 2013-02-09 01:24:36 UTC (rev 142333)
+++ trunk/Source/WebCore/ChangeLog 2013-02-09 01:32:16 UTC (rev 142334)
@@ -1,3 +1,21 @@
+2013-02-08 Eric Carlson <[email protected]>
+
+ [Mac] In-band closed caption tracks are not always initialized correctly
+ https://bugs.webkit.org/show_bug.cgi?id=109323
+
+ Reviewed by Dean Jackson.
+
+ No new tests, this fix makes existing tests less flakey.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Create and configure legible output
+ here instad of in tracksChanged.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible): Do nothing in a build with
+ in-band track support.
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Move legible output creation to
+ createAVPlayerItem, don't set look at track media type to see if the movie has captions
+ when we have support for in-band captions.
+
2013-02-08 Dean Jackson <[email protected]>
Snapshotted plug-in should use shadow root
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (142333 => 142334)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2013-02-09 01:24:36 UTC (rev 142333)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2013-02-09 01:32:16 UTC (rev 142334)
@@ -437,6 +437,22 @@
if (m_avPlayer)
[m_avPlayer.get() replaceCurrentItemWithPlayerItem:m_avPlayerItem.get()];
+#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
+ const NSTimeInterval legibleOutputAdvanceInterval = 2;
+
+ m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:[NSArray array]]);
+ [m_legibleOutput.get() setSuppressesPlayerRendering:YES];
+
+ // We enabled automatic media selection because we want alternate audio tracks to be enabled/disabled automatically,
+ // but set the selected legible track to nil so text tracks will not be automatically configured.
+ [m_avPlayerItem.get() selectMediaOption:nil inMediaSelectionGroup:[m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]];
+
+ [m_legibleOutput.get() setDelegate:m_objcObserver.get() queue:dispatch_get_main_queue()];
+ [m_legibleOutput.get() setAdvanceIntervalForDelegateInvocation:legibleOutputAdvanceInterval];
+ [m_legibleOutput.get() setTextStylingResolution:AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly];
+ [m_avPlayerItem.get() addOutput:m_legibleOutput.get()];
+#endif
+
setDelayCallbacks(false);
}
@@ -595,8 +611,12 @@
if (!metaDataAvailable())
return;
+#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
+ UNUSED_PARAM(closedCaptionsVisible);
+#else
LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible(%p) - setting to %s", this, boolString(closedCaptionsVisible));
[m_avPlayer.get() setClosedCaptionDisplayEnabled:closedCaptionsVisible];
+#endif
}
void MediaPlayerPrivateAVFoundationObjC::updateRate()
@@ -904,24 +924,6 @@
if (!m_avAsset)
return;
-#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
- const NSTimeInterval legibleOutputAdvanceInterval = 2;
-
- if (m_avPlayerItem && !m_legibleOutput) {
- m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:[NSArray array]]);
- [m_legibleOutput.get() setSuppressesPlayerRendering:YES];
-
- // We enabled automatic media selection because we want alternate audio tracks to be enabled/disabled automatically,
- // but set the selected legible track to nil so text tracks will not be automatically configured.
- [m_avPlayerItem.get() selectMediaOption:nil inMediaSelectionGroup:[m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]];
-
- [m_legibleOutput.get() setDelegate:m_objcObserver.get() queue:dispatch_get_main_queue()];
- [m_legibleOutput.get() setAdvanceIntervalForDelegateInvocation:legibleOutputAdvanceInterval];
- [m_legibleOutput.get() setTextStylingResolution:AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly];
- [m_avPlayerItem.get() addOutput:m_legibleOutput.get()];
- }
-#endif
-
bool hasCaptions = false;
// This is called whenever the tracks collection changes so cache hasVideo and hasAudio since we are
@@ -931,7 +933,9 @@
// prior to becoming ready to play.
setHasVideo([[m_avAsset.get() tracksWithMediaCharacteristic:AVMediaCharacteristicVisual] count]);
setHasAudio([[m_avAsset.get() tracksWithMediaCharacteristic:AVMediaCharacteristicAudible] count]);
+#if !HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
hasCaptions = [[m_avAsset.get() tracksWithMediaType:AVMediaTypeClosedCaption] count];
+#endif
} else {
bool hasVideo = false;
bool hasAudio = false;
@@ -943,8 +947,10 @@
hasVideo = true;
else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeAudio])
hasAudio = true;
+#if !HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeClosedCaption])
hasCaptions = true;
+#endif
}
}
setHasVideo(hasVideo);
@@ -952,7 +958,7 @@
}
#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
- if (!hasCaptions) {
+ if (!hasCaptions && m_legibleOutput) {
AVMediaSelectionGroupType *legibleGroup = [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
hasCaptions = [[AVMediaSelectionGroup playableMediaSelectionOptionsFromArray:[legibleGroup options]] count];
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes