<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188393] branches/safari-601.1-branch</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188393">188393</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-08-13 12:49:40 -0700 (Thu, 13 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/188390">r188390</a>. rdar://problem/21367467</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsChangeLog">branches/safari-601.1-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6011branchLayoutTestsmediaeventattributesexpectedtxt">branches/safari-601.1-branch/LayoutTests/media/event-attributes-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestsmediaeventattributeshtml">branches/safari-601.1-branch/LayoutTests/media/event-attributes.html</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformeflTestExpectations">branches/safari-601.1-branch/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformgtkTestExpectations">branches/safari-601.1-branch/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformmacTestExpectations">branches/safari-601.1-branch/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#branchessafari6011branchLayoutTestsplatformwinTestExpectations">branches/safari-601.1-branch/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreChangeLog">branches/safari-601.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6011branchSourceWebCorehtmlHTMLMediaElementcpp">branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCorehtmlHTMLMediaElementh">branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#branchessafari6011branchSourceWebCorehtmlHTMLMediaElementEnumsh">branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElementEnums.h</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreplatformGenericTaskQueueh">branches/safari-601.1-branch/Source/WebCore/platform/GenericTaskQueue.h</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationcpp">branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp</a></li>
<li><a href="#branchessafari6011branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6011branchLayoutTestsmediavideoseektocurrenttimeexpectedtxt">branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time-expected.txt</a></li>
<li><a href="#branchessafari6011branchLayoutTestsmediavideoseektocurrenttimehtml">branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6011branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/ChangeLog (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-08-13 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r188390. rdar://problem/21367467
+
+ 2015-08-13 Eric Carlson <eric.carlson@apple.com>
+
+ Don't short circuit seeking
+ https://bugs.webkit.org/show_bug.cgi?id=147892
+
+ Reviewed by Jer Noble.
+
+ * media/event-attributes-expected.txt: Update for test change.
+ * media/event-attributes.html: There is no reason to expect that a 'timeupdate' will have
+ been sent before 'canplaythrough'.
+ * media/video-seek-to-current-time-expected.txt: Added.
+ * media/video-seek-to-current-time.html: Added.
+ * platform/efl/TestExpectations: Skip new test.
+ * platform/gtk/TestExpectations: Ditto.
+ * platform/mac/TestExpectations: Mark the new test as sometimes failing because of
+ webkit.org/b/147944.
+ * platform/win/TestExpectations: Skip new test.
+
</ins><span class="cx"> 2015-08-11 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r188263. rdar://problem/22202935
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsmediaeventattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/media/event-attributes-expected.txt (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/media/event-attributes-expected.txt        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/LayoutTests/media/event-attributes-expected.txt        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -5,7 +5,6 @@
</span><span class="cx"> EVENT(loadeddata)
</span><span class="cx"> EVENT(canplay)
</span><span class="cx"> EVENT(canplaythrough)
</span><del>-EXPECTED (progressEventCount >= '1') OK
</del><span class="cx">
</span><span class="cx"> *** starting playback
</span><span class="cx"> RUN(video.play())
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsmediaeventattributeshtml"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/media/event-attributes.html (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/media/event-attributes.html        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/LayoutTests/media/event-attributes.html        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -18,7 +18,6 @@
</span><span class="cx"> switch (event.type)
</span><span class="cx"> {
</span><span class="cx"> case "canplaythrough":
</span><del>- testExpected('progressEventCount', 1, '>=');
</del><span class="cx"> consoleWrite("<br>*** starting playback");
</span><span class="cx"> run("video.play()");
</span><span class="cx"> break;
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsmediavideoseektocurrenttimeexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time-expected.txt (0 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time-expected.txt         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time-expected.txt        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+
+Test that setting currentTime immediately after fastSeek() works correctly.
+
+EVENT(canplaythrough)
+
+Seek to a specific time:
+RUN(video.currentTime = 2.5)
+EVENT(seeked)
+EXPECTED (video.currentTime == '2.5') OK
+
+Set currentTime shortly after calling fastSeek():
+RUN(video.fastSeek(4.6))
+RUN(setTimeout(function() { video.currentTime = 2.5; }, 10))
+
+EVENT(seeked)
+EVENT(seeked)
+EXPECTED (video.currentTime == '2.5') OK
+
+END OF TEST
+
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsmediavideoseektocurrenttimehtml"></a>
<div class="addfile"><h4>Added: branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time.html (0 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time.html         (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/media/video-seek-to-current-time.html        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src=media-file.js></script>
+ <script src=video-test.js></script>
+ <script>
+
+ // The test.mp4 file has sync samples at the following presentation time stamps:
+ // 0.0000, 0.7968, 1.5936, 2.3904, 3.1872, 3.9840, 4.7808, 5.5776
+ seekedCount = 0;
+
+ function setup()
+ {
+ findMediaElement();
+ waitForEvent('canplaythrough', canplaythrough);
+
+ // Other media files may have sync samples at completely different points, so
+ // explicitly use the .mp4 here.
+ video.src = "content/test.mp4";
+ }
+
+ function canplaythrough()
+ {
+ consoleWrite('<br><em>Seek to a specific time:</em>');
+ run('video.currentTime = 2.5');
+ waitForEventOnce('seeked', prepareTest);
+ }
+
+ function prepareTest()
+ {
+ testExpected('video.currentTime', 2.5);
+
+ consoleWrite('<br><em>Set currentTime shortly after calling fastSeek():</em>');
+ run('video.fastSeek(4.6)');
+
+ run('setTimeout(function() { video.currentTime = 2.5; }, 10)');
+ waitForEvent('seeked', runTest);
+ seekedCount = 0;
+ consoleWrite('');
+
+ // The second 'seeked' event is occasionally not sent, so fail the test it we don't
+ // get it in 1.5 seconds instead of waiting for the full timeout.
+ // https://bugs.webkit.org/show_bug.cgi?id=147944
+ failTestIn(1500);
+ }
+
+ function runTest()
+ {
+ if (++seekedCount == 1)
+ return;
+
+ testExpected('video.currentTime', 2.5);
+ consoleWrite('');
+ endTest();
+ }
+
+ </script>
+</head>
+<body onload="setup()">
+ <video controls></video>
+ <p>Test that setting currentTime immediately after fastSeek() works correctly.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/efl/TestExpectations (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/efl/TestExpectations        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/LayoutTests/platform/efl/TestExpectations        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -2288,3 +2288,6 @@
</span><span class="cx"> accessibility/radio-button-group-members.html [ Missing ]
</span><span class="cx"> editing/selection/designmode-no-caret.html [ Missing ]
</span><span class="cx"> accessibility/content-editable-as-textarea.html [ Missing ]
</span><ins>+
+# This test uses an MPEG-4 video
+media/video-seek-to-current-time.html [ Skip ]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/gtk/TestExpectations (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/gtk/TestExpectations        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/LayoutTests/platform/gtk/TestExpectations        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -2400,3 +2400,6 @@
</span><span class="cx"> # Test requires hardcoded font names, which I do not have for this port.
</span><span class="cx"> fast/text/han-generic-font-families.html [ WontFix ]
</span><span class="cx"> fast/text/hangul-generic-font-families.html [ WontFix ]
</span><ins>+
+# This test uses an MPEG-4 video
+media/video-seek-to-current-time.html [ Skip ]
</ins></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/mac/TestExpectations (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/mac/TestExpectations        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac/TestExpectations        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -978,6 +978,7 @@
</span><span class="cx"> webkit.org/b/141084 [ Yosemite ] http/tests/media/video-preload.html [ Pass Timeout ]
</span><span class="cx"> webkit.org/b/141294 compositing/reflections/masked-reflection-on-composited.html [ Pass Crash ]
</span><span class="cx"> webkit.org/b/142152 media/track/track-in-band-cues-added-once.html [ Pass Failure ]
</span><ins>+webkit.org/b/147944 media/video-seek-to-current-time.html [ Pass Failure ]
</ins><span class="cx"> ## --- End flaky media tests
</span><span class="cx">
</span><span class="cx"> # Skipped while Eric Carlson works on a fix.
</span></span></pre></div>
<a id="branchessafari6011branchLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/LayoutTests/platform/win/TestExpectations (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/LayoutTests/platform/win/TestExpectations        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/LayoutTests/platform/win/TestExpectations        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -3124,3 +3124,6 @@
</span><span class="cx">
</span><span class="cx"> # New test for Bug 144830 (r186388) always fails.
</span><span class="cx"> http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html [ Failure ]
</span><ins>+
+# This test uses an MPEG-4 video
+media/video-seek-to-current-time.html [ Skip ]
</ins></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2015-08-13 Matthew Hanson <matthew_hanson@apple.com>
+
+ Merge r188390. rdar://problem/21367467
+
+ 2015-08-13 Eric Carlson <eric.carlson@apple.com>
+
+ Don't short circuit seeking
+ https://bugs.webkit.org/show_bug.cgi?id=147892
+
+ Reviewed by Jer Noble.
+
+ Test: media/video-seek-to-current-time.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::prepareForLoad): Call clearSeeking.
+ (WebCore::HTMLMediaElement::fastSeek): Add logging.
+ (WebCore::HTMLMediaElement::seekWithTolerance): Add logging. Set m_pendingSeekType.
+ (WebCore::HTMLMediaElement::seekTask): Call clearSeeking. Don't short circuit a
+ if the current or pending seek is a fast seek. Set m_seeking to true immediately
+ before calling media engine as it may have been cleared before the seek task
+ queue ran.
+ (WebCore::HTMLMediaElement::clearSeeking): New.
+ * html/HTMLMediaElement.h:
+ * html/HTMLMediaElementEnums.h:
+
+ * platform/GenericTaskQueue.h:
+ (WebCore::GenericTaskQueue::enqueueTask): Clear m_pendingTasks.
+
+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundation::seekWithTolerance): Don't return early
+ when asked to seek to the current time.
+ (WebCore::MediaPlayerPrivateAVFoundation::invalidateCachedDuration): Remove some
+ extremely noisy logging.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime): Add logging.
+
</ins><span class="cx"> 2015-08-11 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r188263. rdar://problem/22202935
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.cpp        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -987,7 +987,7 @@
</span><span class="cx"> m_paused = true;
</span><span class="cx">
</span><span class="cx"> // 4.6 - If seeking is true, set it to false.
</span><del>- m_seeking = false;
</del><ins>+ clearSeeking();
</ins><span class="cx">
</span><span class="cx"> // 4.7 - Set the current playback position to 0.
</span><span class="cx"> // Set the official playback position to 0.
</span><span class="lines">@@ -2444,8 +2444,10 @@
</span><span class="cx"> // already running. Abort that other instance of the algorithm without waiting for the step that
</span><span class="cx"> // it is running to complete.
</span><span class="cx"> if (m_seekTaskQueue.hasPendingTasks()) {
</span><ins>+ LOG(Media, "HTMLMediaElement::seekWithTolerance(%p) - cancelling pending seeks", this);
</ins><span class="cx"> m_seekTaskQueue.cancelAllTasks();
</span><span class="cx"> m_pendingSeek = nullptr;
</span><ins>+ m_pendingSeekType = NoSeek;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // 4 - Set the seeking IDL attribute to true.
</span><span class="lines">@@ -2460,16 +2462,19 @@
</span><span class="cx"> // 5 - If the seek was in response to a DOM method call or setting of an IDL attribute, then continue
</span><span class="cx"> // the script. The remainder of these steps must be run asynchronously.
</span><span class="cx"> m_pendingSeek = std::make_unique<PendingSeek>(now, time, negativeTolerance, positiveTolerance);
</span><del>- if (fromDOM)
</del><ins>+ if (fromDOM) {
+ LOG(Media, "HTMLMediaElement::seekWithTolerance(%p) - enqueuing seek from %s to %s", this, toString(now).utf8().data(), toString(time).utf8().data());
</ins><span class="cx"> m_seekTaskQueue.enqueueTask(std::bind(&HTMLMediaElement::seekTask, this));
</span><del>- else
</del><ins>+ } else
</ins><span class="cx"> seekTask();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void HTMLMediaElement::seekTask()
</span><span class="cx"> {
</span><ins>+ LOG(Media, "HTMLMediaElement::seekTask(%p)", this);
+
</ins><span class="cx"> if (!m_player) {
</span><del>- m_seeking = false;
</del><ins>+ clearSeeking();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2496,7 +2501,7 @@
</span><span class="cx"> #if !LOG_DISABLED
</span><span class="cx"> MediaTime mediaTime = m_player->mediaTimeForTimeValue(time);
</span><span class="cx"> if (time != mediaTime)
</span><del>- LOG(Media, "HTMLMediaElement::seekTimerFired(%p) - %s - media timeline equivalent is %s", this, toString(time).utf8().data(), toString(mediaTime).utf8().data());
</del><ins>+ LOG(Media, "HTMLMediaElement::seekTask(%p) - %s - media timeline equivalent is %s", this, toString(time).utf8().data(), toString(mediaTime).utf8().data());
</ins><span class="cx"> #endif
</span><span class="cx"> time = m_player->mediaTimeForTimeValue(time);
</span><span class="cx">
</span><span class="lines">@@ -2505,11 +2510,14 @@
</span><span class="cx"> // that is the nearest to the new playback position. ... If there are no ranges given in the seekable
</span><span class="cx"> // attribute then set the seeking IDL attribute to false and abort these steps.
</span><span class="cx"> RefPtr<TimeRanges> seekableRanges = seekable();
</span><ins>+ bool noSeekRequired = !seekableRanges->length();
</ins><span class="cx">
</span><span class="cx"> // Short circuit seeking to the current time by just firing the events if no seek is required.
</span><del>- // Don't skip calling the media engine if we are in poster mode because a seek should always
- // cancel poster display.
- bool noSeekRequired = !seekableRanges->length() || (time == now && displayMode() != Poster);
</del><ins>+ // Don't skip calling the media engine if 1) we are in poster mode (because a seek should always cancel
+ // poster display), or 2) if there is a pending fast seek, or 3) if this seek is not an exact seek
+ SeekType thisSeekType = (negativeTolerance == MediaTime::zeroTime() && positiveTolerance == MediaTime::zeroTime()) ? Precise : Fast;
+ if (!noSeekRequired && time == now && thisSeekType == Precise && m_pendingSeekType != Fast && displayMode() != Poster)
+ noSeekRequired = true;
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><span class="cx"> // Always notify the media engine of a seek if the source is not closed. This ensures that the source is
</span><span class="lines">@@ -2519,18 +2527,21 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> if (noSeekRequired) {
</span><ins>+ LOG(Media, "HTMLMediaElement::seekTask(%p) - seek to %s ignored", this, toString(time).utf8().data());
</ins><span class="cx"> if (time == now) {
</span><span class="cx"> scheduleEvent(eventNames().seekingEvent);
</span><span class="cx"> scheduleTimeupdateEvent(false);
</span><span class="cx"> scheduleEvent(eventNames().seekedEvent);
</span><span class="cx"> }
</span><del>- m_seeking = false;
</del><ins>+ clearSeeking();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> time = seekableRanges->ranges().nearest(time);
</span><span class="cx">
</span><span class="cx"> m_sentEndEvent = false;
</span><span class="cx"> m_lastSeekTime = time;
</span><ins>+ m_pendingSeekType = thisSeekType;
+ m_seeking = true;
</ins><span class="cx">
</span><span class="cx"> // 10 - Queue a task to fire a simple event named seeking at the element.
</span><span class="cx"> scheduleEvent(eventNames().seekingEvent);
</span><span class="lines">@@ -2543,14 +2554,21 @@
</span><span class="cx"> // 13 - Await a stable state. The synchronous section consists of all the remaining steps of this algorithm.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void HTMLMediaElement::clearSeeking()
+{
+ m_seeking = false;
+ m_pendingSeekType = NoSeek;
+ invalidateCachedTime();
+}
+
</ins><span class="cx"> void HTMLMediaElement::finishSeek()
</span><span class="cx"> {
</span><del>- LOG(Media, "HTMLMediaElement::finishSeek(%p)", this);
-
</del><span class="cx"> // 4.8.10.9 Seeking
</span><span class="cx"> // 14 - Set the seeking IDL attribute to false.
</span><del>- m_seeking = false;
</del><ins>+ clearSeeking();
</ins><span class="cx">
</span><ins>+ LOG(Media, "HTMLMediaElement::finishSeek(%p) - current time = %s", this, toString(currentMediaTime()).utf8().data());
+
</ins><span class="cx"> // 15 - Run the time maches on steps.
</span><span class="cx"> // Handled by mediaPlayerTimeChanged().
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.h (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.h        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElement.h        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -620,7 +620,7 @@
</span><span class="cx"> void seekInternal(const MediaTime&);
</span><span class="cx"> void seekWithTolerance(const MediaTime&, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance, bool fromDOM);
</span><span class="cx"> void finishSeek();
</span><del>- void checkIfSeekNeeded();
</del><ins>+ void clearSeeking();
</ins><span class="cx"> void addPlayedRange(const MediaTime& start, const MediaTime& end);
</span><span class="cx">
</span><span class="cx"> void scheduleTimeupdateEvent(bool periodicEvent);
</span><span class="lines">@@ -782,6 +782,7 @@
</span><span class="cx"> MediaTime positiveTolerance;
</span><span class="cx"> };
</span><span class="cx"> std::unique_ptr<PendingSeek> m_pendingSeek;
</span><ins>+ SeekType m_pendingSeekType { NoSeek };
</ins><span class="cx">
</span><span class="cx"> double m_volume;
</span><span class="cx"> bool m_volumeInitialized;
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCorehtmlHTMLMediaElementEnumsh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElementEnums.h (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElementEnums.h        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/Source/WebCore/html/HTMLMediaElementEnums.h        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -49,6 +49,12 @@
</span><span class="cx"> enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO_SOURCE };
</span><span class="cx"> enum TextTrackVisibilityCheckType { CheckTextTrackVisibility, AssumeTextTrackVisibilityChanged };
</span><span class="cx"> enum InvalidURLAction { DoNothing, Complain };
</span><ins>+
+ typedef enum {
+ NoSeek,
+ Fast,
+ Precise
+ } SeekType;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreplatformGenericTaskQueueh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/platform/GenericTaskQueue.h (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/platform/GenericTaskQueue.h        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/Source/WebCore/platform/GenericTaskQueue.h        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -102,6 +102,8 @@
</span><span class="cx"> m_dispatcher.postTask([weakThis, task] {
</span><span class="cx"> if (!weakThis)
</span><span class="cx"> return;
</span><ins>+ ASSERT(weakThis->m_pendingTasks);
+ --weakThis->m_pendingTasks;
</ins><span class="cx"> task();
</span><span class="cx"> });
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -274,9 +274,6 @@
</span><span class="cx"> if (time > durationMediaTime())
</span><span class="cx"> time = durationMediaTime();
</span><span class="cx">
</span><del>- if (currentMediaTime() == time)
- return;
-
</del><span class="cx"> if (currentTextTrack())
</span><span class="cx"> currentTextTrack()->beginSeeking();
</span><span class="cx">
</span><span class="lines">@@ -684,8 +681,6 @@
</span><span class="cx">
</span><span class="cx"> void MediaPlayerPrivateAVFoundation::invalidateCachedDuration()
</span><span class="cx"> {
</span><del>- LOG(Media, "MediaPlayerPrivateAVFoundation::invalidateCachedDuration(%p)", this);
-
</del><span class="cx"> m_cachedDuration = MediaTime::invalidTime();
</span><span class="cx">
</span><span class="cx"> // For some media files, reported duration is estimated and updated as media is loaded
</span></span></pre></div>
<a id="branchessafari6011branchSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (188392 => 188393)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2015-08-13 19:19:28 UTC (rev 188392)
+++ branches/safari-601.1-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2015-08-13 19:49:40 UTC (rev 188393)
</span><span class="lines">@@ -1305,9 +1305,14 @@
</span><span class="cx">
</span><span class="cx"> auto weakThis = createWeakPtr();
</span><span class="cx">
</span><ins>+ LOG(Media, "MediaPlayerPrivateAVFoundationObjC::seekToTime(%p) - calling seekToTime", this);
+
</ins><span class="cx"> [m_avPlayerItem.get() seekToTime:cmTime toleranceBefore:cmBefore toleranceAfter:cmAfter completionHandler:^(BOOL finished) {
</span><del>- callOnMainThread([weakThis, finished] {
</del><ins>+ double currentTime = CMTimeGetSeconds([m_avPlayerItem currentTime]);
+ callOnMainThread([weakThis, finished, currentTime] {
+ UNUSED_PARAM(currentTime);
</ins><span class="cx"> auto _this = weakThis.get();
</span><ins>+ LOG(Media, "MediaPlayerPrivateAVFoundationObjC::seekToTime(%p) - completion handler called, currentTime = %f", _this, currentTime);
</ins><span class="cx"> if (!_this)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>