Changeset 70814 in webkit


Ignore:
Timestamp:
Oct 28, 2010 2:46:48 PM (13 years ago)
Author:
eric.carlson@apple.com
Message:

2010-10-28 Eric Carlson <eric.carlson@apple.com>

Reviewed by Adam Roben.

Seeking by very small increment doesn't generate 'seeked' event
https://bugs.webkit.org/show_bug.cgi?id=48530

Test: media/video-seek-by-small-increment.html

  • html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seek): Ask the media engine for its closest time value so we can avoid asking it to seek to the current time.
  • platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::mediaTimeForTimeValue): New.
  • platform/graphics/MediaPlayer.h:
  • platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::mediaTimeForTimeValue): Ditto.
  • platform/graphics/mac/MediaPlayerPrivateQTKit.h:
  • platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivate::mediaTimeForTimeValue): Return the closest value in the movie's time scale.
  • platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: (WebCore::MediaPlayerPrivateQuickTimeVisualContext::mediaTimeForTimeValue): Ditto
  • platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
  • platform/graphics/win/QTMovie.cpp: (QTMovie::timeScale): Return the movie's time scale.
  • platform/graphics/win/QTMovie.h:

2010-10-28 Eric Carlson <eric.carlson@apple.com>

Reviewed by Adam Roben.

Seeking by very small increment doesn't generate 'seeked' event
https://bugs.webkit.org/show_bug.cgi?id=48530

  • media/video-seek-by-small-increment-expected.txt: Added.
  • media/video-seek-by-small-increment.html: Added.
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r70813 r70814  
     12010-10-28  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Seeking by very small increment doesn't generate 'seeked' event
     6        https://bugs.webkit.org/show_bug.cgi?id=48530
     7
     8        * media/video-seek-by-small-increment-expected.txt: Added.
     9        * media/video-seek-by-small-increment.html: Added.
     10
    1112010-10-28  David Hyatt  <hyatt@apple.com>
    212
  • trunk/WebCore/ChangeLog

    r70813 r70814  
     12010-10-28  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Seeking by very small increment doesn't generate 'seeked' event
     6        https://bugs.webkit.org/show_bug.cgi?id=48530
     7
     8        Test: media/video-seek-by-small-increment.html
     9
     10        * html/HTMLMediaElement.cpp:
     11        (WebCore::HTMLMediaElement::seek): Ask the media engine for its closest time value so we can
     12        avoid asking it to seek to the current time.
     13
     14        * platform/graphics/MediaPlayer.cpp:
     15        (WebCore::MediaPlayer::mediaTimeForTimeValue): New.
     16        * platform/graphics/MediaPlayer.h:
     17        * platform/graphics/MediaPlayerPrivate.h:
     18        (WebCore::MediaPlayerPrivateInterface::mediaTimeForTimeValue): Ditto.
     19
     20        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
     21        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
     22        (WebCore::MediaPlayerPrivate::mediaTimeForTimeValue): Return the closest value in the movie's time scale.
     23
     24        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
     25        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::mediaTimeForTimeValue): Ditto
     26        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
     27
     28        * platform/graphics/win/QTMovie.cpp:
     29        (QTMovie::timeScale): Return the movie's time scale.
     30        * platform/graphics/win/QTMovie.h:
     31
    1322010-10-28  David Hyatt  <hyatt@apple.com>
    233
  • trunk/WebCore/html/HTMLMediaElement.cpp

    r70065 r70814  
    11141114    time = max(time, earliestTime);
    11151115
     1116    // Ask the media engine for the time value in the movie's time scale before comparing with current time. This
     1117    // is necessary because if the seek time is not equal to currentTime but the delta is less than the movie's
     1118    // time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
     1119    // not generate a timechanged callback. This means m_seeking will never be cleared and we will never
     1120    // fire a 'seeked' event.
     1121#if !LOG_DISABLED
     1122    float mediaTime = m_player->mediaTimeForTimeValue(time);
     1123    if (time != mediaTime)
     1124        LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
     1125#endif
     1126    time = m_player->mediaTimeForTimeValue(time);
     1127
    11161128    // 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
    11171129    // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
  • trunk/WebCore/platform/graphics/MediaPlayer.cpp

    r68526 r70814  
    644644}
    645645
     646float MediaPlayer::mediaTimeForTimeValue(float timeValue) const
     647{
     648    return m_private->mediaTimeForTimeValue(timeValue);
     649}
     650
    646651// Client callbacks.
    647652void MediaPlayer::networkStateChanged()
  • trunk/WebCore/platform/graphics/MediaPlayer.h

    r66961 r70814  
    275275    bool hasSingleSecurityOrigin() const;
    276276
     277    float mediaTimeForTimeValue(float) const;
     278
    277279private:
    278280    MediaPlayer(MediaPlayerClient*);
  • trunk/WebCore/platform/graphics/MediaPlayerPrivate.h

    r65021 r70814  
    126126    virtual void prepareForRendering() { }
    127127
     128    // Time value in the movie's time scale. It is only necessary to override this if the media
     129    // engine uses rational numbers to represent media time.
     130    virtual float mediaTimeForTimeValue(float timeValue) const { return timeValue; }
     131
    128132};
    129133
  • trunk/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h

    r64884 r70814  
    174174    bool isReadyForVideoSetup() const;
    175175   
     176    virtual float mediaTimeForTimeValue(float) const;
     177
    176178    MediaPlayer* m_player;
    177179    RetainPtr<QTMovie> m_qtMovie;
  • trunk/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

    r66652 r70814  
    15411541}
    15421542
     1543float MediaPlayerPrivate::mediaTimeForTimeValue(float timeValue) const
     1544{
     1545    if (!metaDataAvailable())
     1546        return timeValue;
     1547
     1548    QTTime qttime = createQTTime(timeValue);
     1549    return static_cast<float>(qttime.timeValue) / qttime.timeScale;
     1550}
     1551
    15431552} // namespace WebCore
    15441553
  • trunk/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp

    r70641 r70814  
    10541054}
    10551055
     1056float MediaPlayerPrivateQuickTimeVisualContext::mediaTimeForTimeValue(float timeValue) const
     1057{
     1058    long timeScale;
     1059    if (m_readyState < MediaPlayer::HaveMetadata || !(timeScale = m_movie->timeScale()))
     1060        return timeValue;
     1061
     1062    long mediaTimeValue = static_cast<long>(timeValue * timeScale);
     1063    return static_cast<float>(mediaTimeValue) / timeScale;
     1064}
     1065
    10561066MediaPlayerPrivateQuickTimeVisualContext::MediaRenderingMode MediaPlayerPrivateQuickTimeVisualContext::currentRenderingMode() const
    10571067{
  • trunk/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h

    r70252 r70814  
    174174    void retrieveAndResetMovieTransform();
    175175
     176    virtual float mediaTimeForTimeValue(float) const;
     177
    176178    MediaPlayer* m_player;
    177179    RefPtr<QTMovie> m_movie;
  • trunk/WebCore/platform/graphics/win/QTMovie.cpp

    r67330 r70814  
    739739}
    740740
     741long QTMovie::timeScale() const
     742{
     743    if (!m_private->m_movie)
     744        return 0;
     745
     746    return GetMovieTimeScale(m_private->m_movie);
     747}
     748
    741749static void initializeSupportedTypes()
    742750{
  • trunk/WebCore/platform/graphics/win/QTMovie.h

    r67330 r70814  
    116116    Movie getMovieHandle() const;
    117117
     118    long timeScale() const;
     119
    118120private:
    119121    QTMoviePrivate* m_private;
Note: See TracChangeset for help on using the changeset viewer.