Title: [235334] trunk
Revision
235334
Author
[email protected]
Date
2018-08-24 14:40:50 -0700 (Fri, 24 Aug 2018)

Log Message

Using Touch Bar to scrub video on Youtube results in video playback freeze
https://bugs.webkit.org/show_bug.cgi?id=188926

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-source/media-source-seek-twice.html

When converting from a double-precision float to a MediaTime, a certain amount of precision is lost. If that
results in a round-trip between `float in -> MediaTime -> float out` where in != out, we will wait forever for
the time jump observer to fire. Break the cycle by comparing m_lastSeekTime to the synchronizerTime only after
m_lastSeekTime has been normalized into a rational-time value.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):

LayoutTests:

* media/media-source/media-source-seek-twice-expected.txt: Added.
* media/media-source/media-source-seek-twice.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235333 => 235334)


--- trunk/LayoutTests/ChangeLog	2018-08-24 21:15:00 UTC (rev 235333)
+++ trunk/LayoutTests/ChangeLog	2018-08-24 21:40:50 UTC (rev 235334)
@@ -1,3 +1,13 @@
+2018-08-24  Jer Noble  <[email protected]>
+
+        Using Touch Bar to scrub video on Youtube results in video playback freeze
+        https://bugs.webkit.org/show_bug.cgi?id=188926
+
+        Reviewed by Eric Carlson.
+
+        * media/media-source/media-source-seek-twice-expected.txt: Added.
+        * media/media-source/media-source-seek-twice.html: Added.
+
 2018-08-24  Ryosuke Niwa  <[email protected]>
 
         Remove the flaky test expectation now that the test isn't flaky on bots after r235274.

Added: trunk/LayoutTests/media/media-source/media-source-seek-twice-expected.txt (0 => 235334)


--- trunk/LayoutTests/media/media-source/media-source-seek-twice-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-seek-twice-expected.txt	2018-08-24 21:40:50 UTC (rev 235334)
@@ -0,0 +1,14 @@
+
+RUN(video.src = ""
+EVENT(sourceopen)
+RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
+RUN(sourceBuffer.appendBuffer(loader.initSegment()))
+EVENT(update)
+RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0)))
+EVENT(update)
+RUN(video.currentTime = 0.50000000001)
+EVENT(seeked)
+RUN(video.currentTime = 0.50000000001)
+EVENT(seeked)
+END OF TEST
+

Added: trunk/LayoutTests/media/media-source/media-source-seek-twice.html (0 => 235334)


--- trunk/LayoutTests/media/media-source/media-source-seek-twice.html	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-seek-twice.html	2018-08-24 21:40:50 UTC (rev 235334)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>media-source-abort-resets-parser</title>
+    <script src=""
+    <script src=""
+    <script>
+    var loader;
+    var source;
+    var sourceBuffer;
+
+    window.addEventListener('load', event => {
+        findMediaElement();
+
+        loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
+        loader._onload_ = async () => {
+            source = new MediaSource();
+            run('video.src = ""
+            await waitFor(source, 'sourceopen');
+
+            run('sourceBuffer = source.addSourceBuffer(loader.type())');
+            run('sourceBuffer.appendBuffer(loader.initSegment())');
+            await waitFor(sourceBuffer, 'update');
+
+            run('sourceBuffer.appendBuffer(loader.mediaSegment(0))');
+            await waitFor(sourceBuffer, 'update');
+
+            run('video.currentTime = 0.50000000001');
+            await waitFor(video, 'seeked');
+
+            run('video.currentTime = 0.50000000001');
+            await waitFor(video, 'seeked');
+
+            endTest();
+        };
+        loader._onerror_ = () => {
+            failTest('Media data loading failed');
+        };
+    });
+    </script>
+</head>
+<body>
+    <video controls></video>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (235333 => 235334)


--- trunk/Source/WebCore/ChangeLog	2018-08-24 21:15:00 UTC (rev 235333)
+++ trunk/Source/WebCore/ChangeLog	2018-08-24 21:40:50 UTC (rev 235334)
@@ -1,3 +1,20 @@
+2018-08-24  Jer Noble  <[email protected]>
+
+        Using Touch Bar to scrub video on Youtube results in video playback freeze
+        https://bugs.webkit.org/show_bug.cgi?id=188926
+
+        Reviewed by Eric Carlson.
+
+        Test: media/media-source/media-source-seek-twice.html
+
+        When converting from a double-precision float to a MediaTime, a certain amount of precision is lost. If that
+        results in a round-trip between `float in -> MediaTime -> float out` where in != out, we will wait forever for
+        the time jump observer to fire. Break the cycle by comparing m_lastSeekTime to the synchronizerTime only after
+        m_lastSeekTime has been normalized into a rational-time value.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
+
 2018-08-24  Ryosuke Niwa  <[email protected]>
 
         Pass in IsComposed flag to Event constructors

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (235333 => 235334)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2018-08-24 21:15:00 UTC (rev 235333)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2018-08-24 21:40:50 UTC (rev 235334)
@@ -415,9 +415,12 @@
     else
         m_lastSeekTime = m_mediaSourcePrivate->fastSeekTimeForMediaTime(pendingSeek->targetTime, pendingSeek->positiveThreshold, pendingSeek->negativeThreshold);
 
-    LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(%p) - seekTime(%s)", this, toString(m_lastSeekTime).utf8().data());
+    if (m_lastSeekTime.hasDoubleValue())
+        m_lastSeekTime = MediaTime::createWithDouble(m_lastSeekTime.toDouble(), MediaTime::DefaultTimeScale);
 
     MediaTime synchronizerTime = PAL::toMediaTime(CMTimebaseGetTime([m_synchronizer timebase]));
+    LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(%p) - seekTime(%s), synchronizerTime(%s)", this, toString(m_lastSeekTime).utf8().data(), toString(synchronizerTime).utf8().data());
+
     bool doesNotRequireSeek = synchronizerTime == m_lastSeekTime;
 
     m_mediaSourcePrivate->willSeek();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to