[Mac] in-band cues sometimes displayed late
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Apr 2013 20:42:49 +0000 (20:42 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Apr 2013 20:42:49 +0000 (20:42 +0000)
commit29dc2e0ac75cd113db77dcfb568bde0f0b1866b0
tree6c378d857e403921d8974eb522abf69a1f73cf5d
parent8c084e1c0ae387cf3766f54425a5094350139252
[Mac] in-band cues sometimes displayed late
https://bugs.webkit.org/show_bug.cgi?id=114629

Reviewed by Jer Noble.

No new tests, this deals with a platform-specific issue that is extremely timing dependent.

* html/track/InbandTextTrack.cpp:
(WebCore::TextTrackCueMap::add): New, two way cue data <-> cue map.
(WebCore::TextTrackCueMap::find):
(WebCore::TextTrackCueMap::remove):
(WebCore::InbandTextTrack::updateCueFromCueData): New, update an existing cue. Set cue end time
    to video duration if it is unknown.
(WebCore::InbandTextTrack::addGenericCue): Look for existing cues without considering duration
    so we can match incomplete cues.
(WebCore::InbandTextTrack::updateGenericCue): New, update an existing cue. This allows us to
    add in-band cues as soon as we get them from the media engine and update them as more
    information becomes available.
(WebCore::InbandTextTrack::removeGenericCue): New, remove an existing cue. This is necessary
    because we never want to keep an incomplete cue when a seek happens.
(WebCore::InbandTextTrack::removeCue): New, base class override so we can keep the two way
    map up to date.
* html/track/InbandTextTrack.h:

* html/track/TextTrack.cpp:
(WebCore::TextTrack::addCue): TextTrack::removeCue takes a RefPtr.
(WebCore::TextTrack::removeCue): Take a RefPtr.
(WebCore::TextTrack::hasCue): Allow caller to request match without considering end time.
* html/track/TextTrack.h:

* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::TextTrackCue): Initialize m_processingCueChanges.
(WebCore::TextTrackCue::willChange): Renamed from cueWillChange. Use m_processingCueChanges
    to avoid thrashing the track when many cue properties will change.
(WebCore::TextTrackCue::didChange): Renamed from cueDidChange. Use m_processingCueChanges
    to avoid thrashing the track when many cue properties will change.
(WebCore::TextTrackCue::setId): cueWillChange -> willChange. cueDidChange -> didChange.
(WebCore::TextTrackCue::setStartTime): Ditto.
(WebCore::TextTrackCue::setEndTime): Ditto.
(WebCore::TextTrackCue::setPauseOnExit): Ditto.
(WebCore::TextTrackCue::setVertical): Ditto.
(WebCore::TextTrackCue::setSnapToLines): Ditto.
(WebCore::TextTrackCue::setLine): Ditto.
(WebCore::TextTrackCue::setPosition): Ditto.
(WebCore::TextTrackCue::setSize): Ditto.
(WebCore::TextTrackCue::setAlign): Ditto.
(WebCore::TextTrackCue::setText): Ditto.
(WebCore::TextTrackCue::setRegionId): Ditto.
(WebCore::TextTrackCue::isEqual): Renamed from operator==, take match rules param.
* html/track/TextTrackCue.h:

* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGeneric::isEqual): Renamed from operator==, take match rules param.
* html/track/TextTrackCueGeneric.h:

* platform/graphics/InbandTextTrackPrivateClient.h: Make GenericCueData refcounted.
(WebCore::GenericCueData::create): New.
(WebCore::GenericCueData::status): Ditto.
(WebCore::GenericCueData::setStatus): Ditto.
(WebCore::GenericCueData::GenericCueData):

* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processCue): Add cues as soon as we get them from the media
    engine, update duration once we know it.
(WebCore::InbandTextTrackPrivateAVF::resetCueValues): Tell the client to remove all incomplete
    cues we have delivered.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::seekCompleted): Do not flush cues when seek completes,
    we did that when the seek started and cues can be delivered before we get the the
    seek completed  notification.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/track/InbandTextTrack.cpp
Source/WebCore/html/track/InbandTextTrack.h
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.h
Source/WebCore/html/track/TextTrackCue.cpp
Source/WebCore/html/track/TextTrackCue.h
Source/WebCore/html/track/TextTrackCueGeneric.cpp
Source/WebCore/html/track/TextTrackCueGeneric.h
Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp