Changeset 68181 in webkit


Ignore:
Timestamp:
Sep 23, 2010 12:37:09 PM (14 years ago)
Author:
eric.carlson@apple.com
Message:

2010-09-23 Eric Carlson <eric.carlson@apple.com>

Reviewed by Simon Fraser

'seeking' event should always fire
https://bugs.webkit.org/show_bug.cgi?id=45694

Update seek algorithm to match current spec.

  • html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::setReadyState): Don't need to fire 'seeking' event here. (WebCore::HTMLMediaElement::seek): Always fire 'seeking'. Update comments. (WebCore::HTMLMediaElement::finishSeek): Update comments. (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Ditto.

2010-09-23 Eric Carlson <eric.carlson@apple.com>

Reviewed by Simon Fraser

'seeking' event should always fire
https://bugs.webkit.org/show_bug.cgi?id=45694

  • media/event-attributes-expected.txt: Update for changes.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68178 r68181  
     12010-09-23  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Simon Fraser
     4
     5        'seeking' event should always fire
     6        https://bugs.webkit.org/show_bug.cgi?id=45694
     7
     8        * media/event-attributes-expected.txt: Update for changes.
     9
    1102010-09-23  Andrew Wilson  <atwilson@chromium.org>
    211
  • trunk/LayoutTests/media/event-attributes-expected.txt

    r63684 r68181  
    2626*** seeking
    2727RUN(video.currentTime = 5.6)
     28EVENT(seeking)
    2829EVENT(seeked)
    2930
  • trunk/WebCore/ChangeLog

    r68180 r68181  
     12010-09-23  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Simon Fraser
     4
     5        'seeking' event should always fire
     6        https://bugs.webkit.org/show_bug.cgi?id=45694
     7
     8        Update seek algorithm to match current spec.
     9
     10        * html/HTMLMediaElement.cpp:
     11        (WebCore::HTMLMediaElement::setReadyState): Don't need to fire 'seeking' event here.
     12        (WebCore::HTMLMediaElement::seek): Always fire 'seeking'. Update comments.
     13        (WebCore::HTMLMediaElement::finishSeek): Update comments.
     14        (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Ditto.
     15
    1162010-09-23  Eric Uhrhane  <ericu@chromium.org>
    217
  • trunk/WebCore/html/HTMLMediaElement.cpp

    r67619 r68181  
    964964
    965965    if (m_seeking) {
    966         // 4.8.10.10, step 8
     966        // 4.8.10.9, step 11
    967967        if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA)
    968968            scheduleEvent(eventNames().waitingEvent);
    969969
    970         // 4.8.10.10, step 9
    971         if (m_readyState < HAVE_CURRENT_DATA) {
    972             if (oldState >= HAVE_CURRENT_DATA)
    973                 scheduleEvent(eventNames().seekingEvent);
    974         } else {
    975             // 4.8.10.10 step 12 & 13.
     970        // 4.8.10.10 step 14 & 15.
     971        if (m_readyState >= HAVE_CURRENT_DATA)
    976972            finishSeek();
    977         }
    978 
    979973    } else {
    980974        if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) {
    981             // 4.8.10.9
     975            // 4.8.10.8
    982976            scheduleTimeupdateEvent(false);
    983977            scheduleEvent(eventNames().waitingEvent);
     
    11021096    float now = currentTime();
    11031097
     1098    // 2 - If the element's seeking IDL attribute is true, then another instance of this algorithm is
     1099    // already running. Abort that other instance of the algorithm without waiting for the step that
     1100    // it is running to complete.
     1101    // Nothing specific to be done here.
     1102
    11041103    // 3 - Set the seeking IDL attribute to true.
    1105     // The flag will be cleared when the engine tells is the time has actually changed
     1104    // The flag will be cleared when the engine tells us the time has actually changed.
    11061105    m_seeking = true;
    11071106
    1108     // 4 - Queue a task to fire a simple event named timeupdate at the element.
    1109     scheduleTimeupdateEvent(false);
    1110 
    1111     // 6 - If the new playback position is later than the end of the media resource, then let it be the end
     1107    // 5 - If the new playback position is later than the end of the media resource, then let it be the end
    11121108    // of the media resource instead.
    11131109    time = min(time, duration());
    11141110
    1115     // 7 - If the new playback position is less than the earliest possible position, let it be that position instead.
     1111    // 6 - If the new playback position is less than the earliest possible position, let it be that position instead.
    11161112    float earliestTime = m_player->startTime();
    11171113    time = max(time, earliestTime);
    11181114
    1119     // 8 - If the (possibly now changed) new playback position is not in one of the ranges given in the
     1115    // 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
    11201116    // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
    11211117    // that is the nearest to the new playback position. ... If there are no ranges given in the seekable
    11221118    // attribute then set the seeking IDL attribute to false and abort these steps.
    11231119    RefPtr<TimeRanges> seekableRanges = seekable();
    1124     if (!seekableRanges->length() || time == now) {
     1120
     1121    // Short circuit seeking to the current time by just firing the events if no seek is required.
     1122    // Don't skip calling the media engine if we are in poster mode because a seek should always
     1123    // cancel poster display.
     1124    bool noSeekRequired = !seekableRanges->length() || (time == now && displayMode() != Poster);
     1125    if (noSeekRequired) {
     1126        if (time == now) {
     1127            scheduleEvent(eventNames().seekingEvent);
     1128            scheduleTimeupdateEvent(false);
     1129            scheduleEvent(eventNames().seekedEvent);
     1130        }
    11251131        m_seeking = false;
    11261132        return;
     
    11351141    m_sentEndEvent = false;
    11361142
    1137     // 9 - Set the current playback position to the given new playback position
     1143    // 8 - Set the current playback position to the given new playback position
    11381144    m_player->seek(time);
    11391145
    1140     // 10-15 are handled, if necessary, when the engine signals a readystate change.
     1146    // 9 - Queue a task to fire a simple event named seeking at the element.
     1147    scheduleEvent(eventNames().seekingEvent);
     1148
     1149    // 10 - Queue a task to fire a simple event named timeupdate at the element.
     1150    scheduleTimeupdateEvent(false);
     1151
     1152    // 11-15 are handled, if necessary, when the engine signals a readystate change.
    11411153}
    11421154
     
    11451157    LOG(Media, "HTMLMediaElement::finishSeek");
    11461158
    1147     // 4.8.10.10 Seeking step 12
     1159    // 4.8.10.9 Seeking step 14
    11481160    m_seeking = false;
    11491161
    1150     // 4.8.10.10 Seeking step 13
     1162    // 4.8.10.9 Seeking step 15
    11511163    scheduleEvent(eventNames().seekedEvent);
    11521164
     
    16611673    scheduleTimeupdateEvent(false);
    16621674
    1663     // 4.8.10.10 step 12 & 13.  Needed if no ReadyState change is associated with the seek.
    1664     if (m_readyState >= HAVE_CURRENT_DATA && m_seeking)
     1675    // 4.8.10.9 step 14 & 15.  Needed if no ReadyState change is associated with the seek.
     1676    if (m_seeking && m_readyState >= HAVE_CURRENT_DATA)
    16651677        finishSeek();
    16661678   
Note: See TracChangeset for help on using the changeset viewer.