Changeset 142334 in webkit


Ignore:
Timestamp:
Feb 8, 2013 5:32:16 PM (11 years ago)
Author:
eric.carlson@apple.com
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r142333 r142334  
     12013-02-08  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Mac] In-band closed caption tracks are not always initialized correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=109323
     5
     6        Reviewed by Dean Jackson.
     7
     8        No new tests, this fix makes existing tests less flakey.
     9
     10        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     11        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Create and configure legible output
     12            here instad of in tracksChanged.
     13        (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible): Do nothing in a build with
     14            in-band track support.
     15        (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Move legible output creation to
     16            createAVPlayerItem, don't set look at track media type to see if the movie has captions
     17            when we have support for in-band captions.
     18
    1192013-02-08  Dean Jackson  <dino@apple.com>
    220
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r142327 r142334  
    438438        [m_avPlayer.get() replaceCurrentItemWithPlayerItem:m_avPlayerItem.get()];
    439439
     440#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
     441    const NSTimeInterval legibleOutputAdvanceInterval = 2;
     442
     443    m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:[NSArray array]]);
     444    [m_legibleOutput.get() setSuppressesPlayerRendering:YES];
     445
     446    // We enabled automatic media selection because we want alternate audio tracks to be enabled/disabled automatically,
     447    // but set the selected legible track to nil so text tracks will not be automatically configured.
     448    [m_avPlayerItem.get() selectMediaOption:nil inMediaSelectionGroup:[m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]];
     449
     450    [m_legibleOutput.get() setDelegate:m_objcObserver.get() queue:dispatch_get_main_queue()];
     451    [m_legibleOutput.get() setAdvanceIntervalForDelegateInvocation:legibleOutputAdvanceInterval];
     452    [m_legibleOutput.get() setTextStylingResolution:AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly];
     453    [m_avPlayerItem.get() addOutput:m_legibleOutput.get()];
     454#endif
     455
    440456    setDelayCallbacks(false);
    441457}
     
    596612        return;
    597613
     614#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
     615    UNUSED_PARAM(closedCaptionsVisible);
     616#else
    598617    LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible(%p) - setting to %s", this, boolString(closedCaptionsVisible));
    599618    [m_avPlayer.get() setClosedCaptionDisplayEnabled:closedCaptionsVisible];
     619#endif
    600620}
    601621
     
    905925        return;
    906926
    907 #if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
    908     const NSTimeInterval legibleOutputAdvanceInterval = 2;
    909 
    910     if (m_avPlayerItem && !m_legibleOutput) {
    911         m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:[NSArray array]]);
    912         [m_legibleOutput.get() setSuppressesPlayerRendering:YES];
    913 
    914         // We enabled automatic media selection because we want alternate audio tracks to be enabled/disabled automatically,
    915         // but set the selected legible track to nil so text tracks will not be automatically configured.
    916         [m_avPlayerItem.get() selectMediaOption:nil inMediaSelectionGroup:[m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]];
    917 
    918         [m_legibleOutput.get() setDelegate:m_objcObserver.get() queue:dispatch_get_main_queue()];
    919         [m_legibleOutput.get() setAdvanceIntervalForDelegateInvocation:legibleOutputAdvanceInterval];
    920         [m_legibleOutput.get() setTextStylingResolution:AVPlayerItemLegibleOutputTextStylingResolutionSourceAndRulesOnly];
    921         [m_avPlayerItem.get() addOutput:m_legibleOutput.get()];
    922     }
    923 #endif
    924 
    925927    bool hasCaptions = false;
    926928
     
    932934        setHasVideo([[m_avAsset.get() tracksWithMediaCharacteristic:AVMediaCharacteristicVisual] count]);
    933935        setHasAudio([[m_avAsset.get() tracksWithMediaCharacteristic:AVMediaCharacteristicAudible] count]);
     936#if !HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
    934937        hasCaptions = [[m_avAsset.get() tracksWithMediaType:AVMediaTypeClosedCaption] count];
     938#endif
    935939    } else {
    936940        bool hasVideo = false;
     
    944948                else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeAudio])
    945949                    hasAudio = true;
     950#if !HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
    946951                else if ([[assetTrack mediaType] isEqualToString:AVMediaTypeClosedCaption])
    947952                    hasCaptions = true;
     953#endif
    948954            }
    949955        }
     
    953959
    954960#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
    955     if (!hasCaptions) {
     961    if (!hasCaptions && m_legibleOutput) {
    956962        AVMediaSelectionGroupType *legibleGroup = [m_avAsset.get() mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
    957963        hasCaptions = [[AVMediaSelectionGroup playableMediaSelectionOptionsFromArray:[legibleGroup options]] count];
Note: See TracChangeset for help on using the changeset viewer.