- Revision
- 220414
- Author
- commit-qu...@webkit.org
- Date
- 2017-08-08 12:03:57 -0700 (Tue, 08 Aug 2017)
Log 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 <jere...@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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (220413 => 220414)
--- trunk/LayoutTests/ChangeLog 2017-08-08 17:22:07 UTC (rev 220413)
+++ trunk/LayoutTests/ChangeLog 2017-08-08 19:03:57 UTC (rev 220414)
@@ -1,3 +1,17 @@
+2017-08-08 Jeremy Jones <jere...@apple.com>
+
+ Change fast seek logic to prevent ping-ponging.
+ https://bugs.webkit.org/show_bug.cgi?id=175167
+ rdar://problem/32936116
+
+ Reviewed by Jer Noble.
+
+ 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:
+
2017-08-08 Ms2ger <ms2...@igalia.com>
Remove obsolete failure expectations for event_loadedmetadata.html.
Modified: trunk/LayoutTests/media/media-source/media-source-fastseek-expected.txt (220413 => 220414)
--- trunk/LayoutTests/media/media-source/media-source-fastseek-expected.txt 2017-08-08 17:22:07 UTC (rev 220413)
+++ trunk/LayoutTests/media/media-source/media-source-fastseek-expected.txt 2017-08-08 19:03:57 UTC (rev 220414)
@@ -11,7 +11,7 @@
RUN(video.currentTime = 1)
EVENT(seeked)
EXPECTED (video.currentTime.toFixed(1) == '1') OK
-RUN(video.fastSeek(2))
+RUN(video.fastSeek(5))
EVENT(seeked)
EXPECTED (video.currentTime.toFixed(1) == '4') OK
RUN(video.currentTime = 3)
Modified: trunk/LayoutTests/media/media-source/media-source-fastseek.html (220413 => 220414)
--- trunk/LayoutTests/media/media-source/media-source-fastseek.html 2017-08-08 17:22:07 UTC (rev 220413)
+++ trunk/LayoutTests/media/media-source/media-source-fastseek.html 2017-08-08 19:03:57 UTC (rev 220414)
@@ -59,7 +59,7 @@
function seeked1() {
testExpected('video.currentTime.toFixed(1)', 1);
waitForEventOnce('seeked', seeked2);
- run('video.fastSeek(2)');
+ run('video.fastSeek(5)');
}
function seeked2() {
Modified: trunk/LayoutTests/media/video-fast-seek-expected.txt (220413 => 220414)
--- trunk/LayoutTests/media/video-fast-seek-expected.txt 2017-08-08 17:22:07 UTC (rev 220413)
+++ trunk/LayoutTests/media/video-fast-seek-expected.txt 2017-08-08 19:03:57 UTC (rev 220414)
@@ -6,15 +6,16 @@
RUN(video.currentTime = 2.5)
EVENT(timeupdate)
EXPECTED (video.currentTime.toFixed(1) == '2.5') OK
-Test that fastSeek() past the currentTime will not result in a seek before the currentTime:
+Test that fastSeek() past the currentTime will not result in a seek before the currentTime or past the seek time:
RUN(video.fastSeek(2.6))
EVENT(timeupdate)
-EXPECTED (video.currentTime >= '2.6') OK
+EXPECTED (video.currentTime <= '2.6') OK
+EXPECTED (video.currentTime >= '2.5') OK
Seek before the 4th sync sample:
RUN(video.currentTime = 2.3)
EVENT(timeupdate)
EXPECTED (video.currentTime.toFixed(1) == '2.3') OK
-Test that fastSeek() before the currentTime will not result in a seek past the currentTime:
+Test that fastSeek() before the currentTime will not result in a seek past the seek time:
RUN(video.fastSeek(2.2))
EVENT(timeupdate)
EXPECTED (video.currentTime <= '2.2') OK
Modified: trunk/LayoutTests/media/video-fast-seek.html (220413 => 220414)
--- trunk/LayoutTests/media/video-fast-seek.html 2017-08-08 17:22:07 UTC (rev 220413)
+++ trunk/LayoutTests/media/video-fast-seek.html 2017-08-08 19:03:57 UTC (rev 220414)
@@ -28,7 +28,7 @@
function seek1()
{
testExpected('video.currentTime.toFixed(1)', 2.5);
- consoleWrite('Test that fastSeek() past the currentTime will not result in a seek before the currentTime:');
+ consoleWrite('Test that fastSeek() past the currentTime will not result in a seek before the currentTime or past the seek time:');
waitForEventOnce('timeupdate', seek2);
run('video.fastSeek(2.6)');
}
@@ -35,7 +35,8 @@
function seek2()
{
- testExpected('video.currentTime', 2.6, '>=');
+ testExpected('video.currentTime', 2.6, '<=');
+ testExpected('video.currentTime', 2.5, '>=');
consoleWrite('Seek before the 4th sync sample:');
waitForEventOnce('timeupdate', seek3);
run('video.currentTime = 2.3');
@@ -44,7 +45,7 @@
function seek3()
{
testExpected('video.currentTime.toFixed(1)', 2.3);
- consoleWrite('Test that fastSeek() before the currentTime will not result in a seek past the currentTime:');
+ consoleWrite('Test that fastSeek() before the currentTime will not result in a seek past the seek time:');
waitForEventOnce('timeupdate', seek4);
run('video.fastSeek(2.2)');
}
Modified: trunk/Source/WebCore/ChangeLog (220413 => 220414)
--- trunk/Source/WebCore/ChangeLog 2017-08-08 17:22:07 UTC (rev 220413)
+++ trunk/Source/WebCore/ChangeLog 2017-08-08 19:03:57 UTC (rev 220414)
@@ -1,3 +1,21 @@
+2017-08-08 Jeremy Jones <jere...@apple.com>
+
+ Change fast seek logic to prevent ping-ponging.
+ https://bugs.webkit.org/show_bug.cgi?id=175167
+ rdar://problem/32936116
+
+ Reviewed by Jer Noble.
+
+ 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):
+
2017-08-08 Ms2ger <ms2...@igalia.com>
Unreviewed. Correct the function name in a debug message.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (220413 => 220414)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-08-08 17:22:07 UTC (rev 220413)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-08-08 19:03:57 UTC (rev 220414)
@@ -2627,11 +2627,10 @@
// position. Similarly, if the new playback position before this step is after current playback position,
// then the adjusted new playback position must also be after the current playback position.
refreshCachedTime();
+
MediaTime delta = time - currentMediaTime();
- MediaTime negativeTolerance = delta >= MediaTime::zeroTime() ? delta : MediaTime::positiveInfiniteTime();
- MediaTime positiveTolerance = delta < MediaTime::zeroTime() ? -delta : MediaTime::positiveInfiniteTime();
-
- seekWithTolerance(time, negativeTolerance, positiveTolerance, true);
+ MediaTime negativeTolerance = delta < MediaTime::zeroTime() ? MediaTime::positiveInfiniteTime() : delta;
+ seekWithTolerance(time, negativeTolerance, MediaTime::zeroTime(), true);
}
void HTMLMediaElement::seek(const MediaTime& time)