Changeset 220414 in webkit


Ignore:
Timestamp:
Aug 8, 2017 12:03:57 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Change fast seek logic to prevent ping-ponging.
https://bugs.webkit.org/show_bug.cgi?id=175167
rdar://problem/32936116

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-08-08
Reviewed by Jer Noble.

Source/WebCore:

Updated test: media/video-fast-seek.html

Changed fast seek behavior to always seek early than seek time; and after current time when seeking forward.
This prevents ping-ponging, where a fast seek overshoots the target looking for a keyframe.
A subsequent seek will suddenly be on the other side of current time and
will search in the opposite direction for a key frame; repeat.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::fastSeek):

LayoutTests:

Test now requires forward fast seek result to be between current time and the target time,
and a backward seek to be before the seek time.

  • media/video-fast-seek.html:
  • media/media-source/media-source-fastseek.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220413 r220414  
     12017-08-08  Jeremy Jones  <jeremyj@apple.com>
     2
     3        Change fast seek logic to prevent ping-ponging.
     4        https://bugs.webkit.org/show_bug.cgi?id=175167
     5        rdar://problem/32936116
     6
     7        Reviewed by Jer Noble.
     8
     9        Test now requires forward fast seek result to be between current time and the target time,
     10        and a backward seek to be before the seek time.
     11
     12        * media/video-fast-seek.html:
     13        * media/media-source/media-source-fastseek.html:
     14
    1152017-08-08  Ms2ger  <Ms2ger@igalia.com>
    216
  • trunk/LayoutTests/media/media-source/media-source-fastseek-expected.txt

    r159519 r220414  
    1212EVENT(seeked)
    1313EXPECTED (video.currentTime.toFixed(1) == '1') OK
    14 RUN(video.fastSeek(2))
     14RUN(video.fastSeek(5))
    1515EVENT(seeked)
    1616EXPECTED (video.currentTime.toFixed(1) == '4') OK
  • trunk/LayoutTests/media/media-source/media-source-fastseek.html

    r159519 r220414  
    6060        testExpected('video.currentTime.toFixed(1)', 1);
    6161        waitForEventOnce('seeked', seeked2);
    62         run('video.fastSeek(2)');
     62        run('video.fastSeek(5)');
    6363    }
    6464
  • trunk/LayoutTests/media/video-fast-seek-expected.txt

    r159306 r220414  
    77EVENT(timeupdate)
    88EXPECTED (video.currentTime.toFixed(1) == '2.5') OK
    9 Test that fastSeek() past the currentTime will not result in a seek before the currentTime:
     9Test that fastSeek() past the currentTime will not result in a seek before the currentTime or past the seek time:
    1010RUN(video.fastSeek(2.6))
    1111EVENT(timeupdate)
    12 EXPECTED (video.currentTime >= '2.6') OK
     12EXPECTED (video.currentTime <= '2.6') OK
     13EXPECTED (video.currentTime >= '2.5') OK
    1314Seek before the 4th sync sample:
    1415RUN(video.currentTime = 2.3)
    1516EVENT(timeupdate)
    1617EXPECTED (video.currentTime.toFixed(1) == '2.3') OK
    17 Test that fastSeek() before the currentTime will not result in a seek past the currentTime:
     18Test that fastSeek() before the currentTime will not result in a seek past the seek time:
    1819RUN(video.fastSeek(2.2))
    1920EVENT(timeupdate)
  • trunk/LayoutTests/media/video-fast-seek.html

    r159306 r220414  
    2929        {
    3030            testExpected('video.currentTime.toFixed(1)', 2.5);
    31             consoleWrite('Test that fastSeek() past the currentTime will not result in a seek before the currentTime:');
     31            consoleWrite('Test that fastSeek() past the currentTime will not result in a seek before the currentTime or past the seek time:');
    3232            waitForEventOnce('timeupdate', seek2);
    3333            run('video.fastSeek(2.6)');
     
    3636        function seek2()
    3737        {
    38             testExpected('video.currentTime', 2.6, '>=');
     38            testExpected('video.currentTime', 2.6, '<=');
     39            testExpected('video.currentTime', 2.5, '>=');
    3940            consoleWrite('Seek before the 4th sync sample:');
    4041            waitForEventOnce('timeupdate', seek3);
     
    4546        {
    4647            testExpected('video.currentTime.toFixed(1)', 2.3);
    47             consoleWrite('Test that fastSeek() before the currentTime will not result in a seek past the currentTime:');
     48            consoleWrite('Test that fastSeek() before the currentTime will not result in a seek past the seek time:');
    4849            waitForEventOnce('timeupdate', seek4);
    4950            run('video.fastSeek(2.2)');
  • trunk/Source/WebCore/ChangeLog

    r220411 r220414  
     12017-08-08  Jeremy Jones  <jeremyj@apple.com>
     2
     3        Change fast seek logic to prevent ping-ponging.
     4        https://bugs.webkit.org/show_bug.cgi?id=175167
     5        rdar://problem/32936116
     6
     7        Reviewed by Jer Noble.
     8
     9        Updated test: media/video-fast-seek.html
     10
     11        Changed fast seek behavior to always seek early than seek time; and after current time when seeking forward.
     12        This prevents ping-ponging, where a fast seek overshoots the target looking for a keyframe.
     13        A subsequent seek will suddenly be on the other side of current time and
     14        will search in the opposite direction for a key frame; repeat.
     15
     16        * html/HTMLMediaElement.cpp:
     17        (WebCore::HTMLMediaElement::fastSeek):
     18
    1192017-08-08  Ms2ger  <Ms2ger@igalia.com>
    220
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r220085 r220414  
    26282628    // then the adjusted new playback position must also be after the current playback position.
    26292629    refreshCachedTime();
     2630
    26302631    MediaTime delta = time - currentMediaTime();
    2631     MediaTime negativeTolerance = delta >= MediaTime::zeroTime() ? delta : MediaTime::positiveInfiniteTime();
    2632     MediaTime positiveTolerance = delta < MediaTime::zeroTime() ? -delta : MediaTime::positiveInfiniteTime();
    2633 
    2634     seekWithTolerance(time, negativeTolerance, positiveTolerance, true);
     2632    MediaTime negativeTolerance = delta < MediaTime::zeroTime() ? MediaTime::positiveInfiniteTime() : delta;
     2633    seekWithTolerance(time, negativeTolerance, MediaTime::zeroTime(), true);
    26352634}
    26362635
Note: See TracChangeset for help on using the changeset viewer.