Title: [214959] trunk
Revision
214959
Author
[email protected]
Date
2017-04-05 12:09:28 -0700 (Wed, 05 Apr 2017)

Log Message

[MSE] Seeks to currentTime=0 will fail if currentTime is already 0.
https://bugs.webkit.org/show_bug.cgi?id=170510
Source/WebCore:

<rdar://problem/30988403>

Reviewed by Eric Carlson.

Test: media/media-source/media-source-unnecessary-seek-seeked.html

The AVSampleBufferRenderSynchronizer won't fire a time jumped notification if no seek is actully
necessary. So short circuit the seek logic if the seek time is identical to the current synchronizer
time.

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

LayoutTests:

Reviewed by Eric Carlson.

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214958 => 214959)


--- trunk/LayoutTests/ChangeLog	2017-04-05 19:08:07 UTC (rev 214958)
+++ trunk/LayoutTests/ChangeLog	2017-04-05 19:09:28 UTC (rev 214959)
@@ -1,3 +1,13 @@
+2017-04-05  Jer Noble  <[email protected]>
+
+        [MSE] Seeks to currentTime=0 will fail if currentTime is already 0.
+        https://bugs.webkit.org/show_bug.cgi?id=170510
+
+        Reviewed by Eric Carlson.
+
+        * media/media-source/media-source-unnecessary-seek-seeked-expected.txt: Added.
+        * media/media-source/media-source-unnecessary-seek-seeked.html: Added.
+
 2017-04-05  Matt Baker  <[email protected]>
 
         Web Inspector: XHR breakpoints should be global

Added: trunk/LayoutTests/media/media-source/media-source-unnecessary-seek-seeked-expected.txt (0 => 214959)


--- trunk/LayoutTests/media/media-source/media-source-unnecessary-seek-seeked-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-unnecessary-seek-seeked-expected.txt	2017-04-05 19:09:28 UTC (rev 214959)
@@ -0,0 +1,14 @@
+
+RUN(video.src = ""
+EVENT(sourceopen)
+RUN(source.duration = loader.duration())
+RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
+RUN(sourceBuffer.appendBuffer(loader.initSegment()))
+EVENT(update)
+Append a media segment.
+RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0)))
+EVENT(update)
+EVENT(seeking)
+EVENT(seeked)
+END OF TEST
+

Added: trunk/LayoutTests/media/media-source/media-source-unnecessary-seek-seeked.html (0 => 214959)


--- trunk/LayoutTests/media/media-source/media-source-unnecessary-seek-seeked.html	                        (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-unnecessary-seek-seeked.html	2017-04-05 19:09:28 UTC (rev 214959)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>media-source-abort-resets-parser</title>
+    <script src=""
+    <script src=""
+    <script>
+    var loader;
+    var source;
+    var sourceBuffer;
+
+    function runTest() {
+        findMediaElement();
+
+        loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
+        loader._onload_ = mediaDataLoaded;
+        loader._onerror_ = mediaDataLoadingFailed;
+    }
+
+    function mediaDataLoadingFailed() {
+        failTest('Media data loading failed');
+    }
+
+    function mediaDataLoaded() {
+        source = new MediaSource();
+        waitForEvent('sourceopen', sourceOpen, false, false, source);
+        run('video.src = ""
+    }
+
+    function sourceOpen() {
+        run('source.duration = loader.duration()');
+        run('sourceBuffer = source.addSourceBuffer(loader.type())');
+        waitForEventOn(sourceBuffer, 'update', sourceInitialized, false, true);
+        run('sourceBuffer.appendBuffer(loader.initSegment())');
+    }
+
+    function sourceInitialized() {
+        consoleWrite('Append a media segment.')
+        waitForEventOn(sourceBuffer, 'update', mediaSegmentAppended, false, true);
+        run('sourceBuffer.appendBuffer(loader.mediaSegment(0))');
+    }
+
+    function mediaSegmentAppended() {
+        waitForEvent('seeking');
+        waitForEventAndEnd('seeked');
+        video.currentTime = video.currentTime;
+        failTestIn(1000);
+    }
+    </script>
+</head>
+<body _onload_="runTest()">
+    <video controls></video>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (214958 => 214959)


--- trunk/Source/WebCore/ChangeLog	2017-04-05 19:08:07 UTC (rev 214958)
+++ trunk/Source/WebCore/ChangeLog	2017-04-05 19:09:28 UTC (rev 214959)
@@ -1,3 +1,20 @@
+2017-04-05  Jer Noble  <[email protected]>
+
+        [MSE] Seeks to currentTime=0 will fail if currentTime is already 0.
+        https://bugs.webkit.org/show_bug.cgi?id=170510
+        <rdar://problem/30988403>
+
+        Reviewed by Eric Carlson.
+
+        Test: media/media-source/media-source-unnecessary-seek-seeked.html
+
+        The AVSampleBufferRenderSynchronizer won't fire a time jumped notification if no seek is actully
+        necessary. So short circuit the seek logic if the seek time is identical to the current synchronizer
+        time.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
+
 2017-04-05  Chris Dumez  <[email protected]>
 
         <input type="range"> changing to disabled while active breaks all pointer events

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-04-05 19:08:07 UTC (rev 214958)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-04-05 19:09:28 UTC (rev 214959)
@@ -411,9 +411,24 @@
 
     LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(%p) - seekTime(%s)", this, toString(m_lastSeekTime).utf8().data());
 
+    MediaTime synchronizerTime = toMediaTime(CMTimebaseGetTime([m_synchronizer timebase]));
+    bool doesNotRequireSeek = synchronizerTime == m_lastSeekTime;
+
     m_mediaSourcePrivate->willSeek();
     [m_synchronizer setRate:0 time:toCMTime(m_lastSeekTime)];
     m_mediaSourcePrivate->seekToTime(m_lastSeekTime);
+
+    // In cases where the destination seek time precisely matches the synchronizer's existing time
+    // no time jumped notification will be issued. In this case, just notify the MediaPlayer that
+    // the seek completed successfully.
+    if (doesNotRequireSeek) {
+        m_seeking = false;
+
+        if (shouldBePlaying())
+            [m_synchronizer setRate:m_rate];
+        if (!seeking() && m_seekCompleted)
+            m_player->timeChanged();
+    }
 }
 
 void MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to