Title: [206326] tags/Safari-603.1.6.0.2

Diff

Modified: tags/Safari-603.1.6.0.2/LayoutTests/ChangeLog (206325 => 206326)


--- tags/Safari-603.1.6.0.2/LayoutTests/ChangeLog	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/LayoutTests/ChangeLog	2016-09-23 20:24:57 UTC (rev 206326)
@@ -1,3 +1,18 @@
+2016-09-23  Babak Shafiei  <[email protected]>
+
+        Merge r206300.
+
+    2016-09-23  Jer Noble  <[email protected]>
+
+            REGRESSION (206001): Scrubbed video on Youtube stops playing
+            https://bugs.webkit.org/show_bug.cgi?id=162481
+            <rdar://problem/28436707>
+
+            Reviewed by Eric Carlson.
+
+            * media/media-source/media-source-seek-back-expected.txt: Added.
+            * media/media-source/media-source-seek-back.html: Added.
+
 2016-09-22  Babak Shafiei  <[email protected]>
 
         Roll out r206165.

Copied: tags/Safari-603.1.6.0.2/LayoutTests/media/media-source/media-source-seek-back-expected.txt (from rev 206300, trunk/LayoutTests/media/media-source/media-source-seek-back-expected.txt) (0 => 206326)


--- tags/Safari-603.1.6.0.2/LayoutTests/media/media-source/media-source-seek-back-expected.txt	                        (rev 0)
+++ tags/Safari-603.1.6.0.2/LayoutTests/media/media-source/media-source-seek-back-expected.txt	2016-09-23 20:24:57 UTC (rev 206326)
@@ -0,0 +1,17 @@
+
+EVENT(sourceopen)
+RUN(sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock"))
+RUN(sourceBuffer.appendBuffer(initSegment))
+EVENT(updateend)
+Append a sample from 10 -> 11
+RUN(sourceBuffer.appendBuffer(samples))
+EVENT(updateend)
+RUN(video.currentTime = 0.5)
+EVENT(seeking)
+Append a sample from 0 -> 1
+RUN(sourceBuffer.appendBuffer(samples))
+EVENT(seeked)
+EXPECTED (enqueuedSamples.length == '1') OK
+{PTS({0/1000, 0.000000}), DTS({0/1000, 0.000000}), duration({1000/1000, 1.000000}), flags(1), generation(0)}
+END OF TEST
+

Copied: tags/Safari-603.1.6.0.2/LayoutTests/media/media-source/media-source-seek-back.html (from rev 206300, trunk/LayoutTests/media/media-source/media-source-seek-back.html) (0 => 206326)


--- tags/Safari-603.1.6.0.2/LayoutTests/media/media-source/media-source-seek-back.html	                        (rev 0)
+++ tags/Safari-603.1.6.0.2/LayoutTests/media/media-source/media-source-seek-back.html	2016-09-23 20:24:57 UTC (rev 206326)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>mock-media-source</title>
+    <script src=""
+    <script src=""
+    <script>
+    var source;
+    var sourceBuffer;
+    var initSegment;
+    var samples;
+
+    if (window.internals)
+        internals.initializeMockMediaSource();
+
+    function runTest()
+    {
+        findMediaElement();
+
+        source = new MediaSource();
+        waitForEventOn(source, 'sourceopen', sourceOpen);
+        var videoSource = document.createElement('source');
+        videoSource.type = 'video/mock; codecs=mock';
+        videoSource.src = ""
+        video.appendChild(videoSource);
+    }
+
+    function sourceOpen()
+    {
+        run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
+        waitForEventOn(sourceBuffer, 'updateend', loadSamples, false, true);
+        initSegment = makeAInit(8, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
+        run('sourceBuffer.appendBuffer(initSegment)');
+    }
+
+    function loadSamples()
+    {
+        samples = concatenateSamples([
+            makeASample(10, 10, 1, 1, SAMPLE_FLAG.SYNC),
+        ]);
+        consoleWrite('Append a sample from 10 -> 11')
+        waitForEventOn(sourceBuffer, 'updateend', seek, false, true);
+        run('sourceBuffer.appendBuffer(samples)');
+    }
+
+    function seek()
+    {
+        waitForEvent('seeking', seeking);
+        run('video.currentTime = 0.5');
+    }
+
+    function seeking()
+    {
+        samples = concatenateSamples([
+            makeASample(0, 0, 1, 1, SAMPLE_FLAG.SYNC),
+        ]);
+        consoleWrite('Append a sample from 0 -> 1')
+        waitForEvent('seeked', seeked);
+        run('sourceBuffer.appendBuffer(samples)');
+    }
+
+    function seeked()
+    {
+        enqueuedSamples = internals.enqueuedSamplesForTrackID(sourceBuffer, 1);
+        testExpected("enqueuedSamples.length", 1);
+        enqueuedSamples.forEach(consoleWrite);
+        endTest();
+    }
+    </script>
+</head>
+<body _onload_="runTest()">
+    <video></video>
+</body>
+</html>

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/ChangeLog (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/ChangeLog	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/ChangeLog	2016-09-23 20:24:57 UTC (rev 206326)
@@ -1,3 +1,45 @@
+2016-09-23  Babak Shafiei  <[email protected]>
+
+        Merge r206300.
+
+    2016-09-23  Jer Noble  <[email protected]>
+
+            REGRESSION (206001): Scrubbed video on Youtube stops playing
+            https://bugs.webkit.org/show_bug.cgi?id=162481
+            <rdar://problem/28436707>
+
+            Reviewed by Eric Carlson.
+
+            Test: media/media-source/media-source-seek-back.html
+
+            When re-enqueing samples after a seek, modified the algorithm for finding the first sample
+            to re-enqueue. Instead of finding a sample which contained the requested presentation time,
+            we searched for the first sample on-or-after the presentation time. This meant that if the
+            last buffered sample in that range started before the seek time, and ended after, it would
+            get skipped during re-enquing, and a far, far future sample would be enqueued instead. Now
+            revert to the old behavior (find the sample containing the requested time), and only adopt
+            the new behavior (find the next sample on-or-after the requested time) if the first failed.
+            In addition, bail out if the second check resulted in a sample whose presentation time was
+            greater than a "fudge factor" away from the requested time.
+
+            To test this behavior, add a new method onto Internals that returns a list of the enqueued
+            samples from a SourceBuffer.
+
+            * Modules/mediasource/SourceBuffer.cpp:
+            (WebCore::SourceBuffer::reenqueueMediaForTime):
+            (WebCore::SourceBuffer::enqueuedSamplesForTrackID):
+            * Modules/mediasource/SourceBuffer.h:
+            * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
+            (WebCore::MockMediaSourcePrivate::seekToTime):
+            * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
+            (WebCore::MockSourceBufferPrivate::enqueuedSamplesForTrackID):
+            (WebCore::MockSourceBufferPrivate::enqueueSample):
+            * platform/mock/mediasource/MockSourceBufferPrivate.h:
+            * testing/Internals.cpp:
+            (WebCore::Internals::enqueuedSamplesForTrackID):
+            * testing/Internals.h:
+            * testing/Internals.idl:
+
 2016-09-22  Babak Shafiei  <[email protected]>
 
         Roll out r206165.

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2016-09-23 20:24:57 UTC (rev 206326)
@@ -1847,9 +1847,13 @@
 void SourceBuffer::reenqueueMediaForTime(TrackBuffer& trackBuffer, AtomicString trackID, const MediaTime& time)
 {
     // Find the sample which contains the current presentation time.
-    auto currentSamplePTSIterator = trackBuffer.samples.presentationOrder().findSampleOnOrAfterPresentationTime(time);
+    auto currentSamplePTSIterator = trackBuffer.samples.presentationOrder().findSampleContainingPresentationTime(time);
 
-    if (currentSamplePTSIterator == trackBuffer.samples.presentationOrder().end()) {
+    if (currentSamplePTSIterator == trackBuffer.samples.presentationOrder().end())
+        currentSamplePTSIterator = trackBuffer.samples.presentationOrder().findSampleOnOrAfterPresentationTime(time);
+
+    if (currentSamplePTSIterator == trackBuffer.samples.presentationOrder().end()
+        || (currentSamplePTSIterator->first - time) > MediaSource::currentTimeFudgeFactor()) {
         trackBuffer.decodeQueue.clear();
         m_private->flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>>(), trackID);
         return;
@@ -2019,6 +2023,11 @@
     return sampleDescriptions;
 }
 
+Vector<String> SourceBuffer::enqueuedSamplesForTrackID(const AtomicString& trackID)
+{
+    return m_private->enqueuedSamplesForTrackID(trackID);
+}
+
 Document& SourceBuffer::document() const
 {
     ASSERT(scriptExecutionContext());

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/Modules/mediasource/SourceBuffer.h (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/Modules/mediasource/SourceBuffer.h	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/Modules/mediasource/SourceBuffer.h	2016-09-23 20:24:57 UTC (rev 206326)
@@ -195,6 +195,7 @@
     // Internals
     friend class Internals;
     WEBCORE_EXPORT Vector<String> bufferedSamplesForTrackID(const AtomicString&);
+    WEBCORE_EXPORT Vector<String> enqueuedSamplesForTrackID(const AtomicString&);
 
     Ref<SourceBufferPrivate> m_private;
     MediaSource* m_source;

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp	2016-09-23 20:24:57 UTC (rev 206326)
@@ -167,8 +167,7 @@
 
 void MockMediaSourcePrivate::seekToTime(const MediaTime& time)
 {
-    for (auto it = m_activeSourceBuffers.begin(), end = m_activeSourceBuffers.end(); it != end; ++it)
-        (*it)->seekToTime(time);
+    m_client->seekToTime(time);
 }
 
 MediaTime MockMediaSourcePrivate::seekToTime(const MediaTime& targetTime, const MediaTime& negativeThreshold, const MediaTime& positiveThreshold)

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp	2016-09-23 20:24:57 UTC (rev 206326)
@@ -225,8 +225,14 @@
         m_mediaSource->sourceBufferPrivateDidChangeActiveState(this, isActive);
 }
 
-void MockSourceBufferPrivate::enqueueSample(PassRefPtr<MediaSample> sample, AtomicString)
+Vector<String> MockSourceBufferPrivate::enqueuedSamplesForTrackID(AtomicString)
 {
+    return m_enqueuedSamples;
+}
+
+void MockSourceBufferPrivate::enqueueSample(PassRefPtr<MediaSample> prpSample, AtomicString)
+{
+    RefPtr<MediaSample> sample = prpSample;
     if (!m_mediaSource || !sample)
         return;
 
@@ -245,6 +251,8 @@
         m_mediaSource->incrementDroppedFrames();
     if (box->isDelayed())
         m_mediaSource->incrementTotalFrameDelayBy(MediaTime(1, 1));
+
+    m_enqueuedSamples.append(toString(sample));
 }
 
 bool MockSourceBufferPrivate::hasVideo() const

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h	2016-09-23 20:24:57 UTC (rev 206326)
@@ -67,16 +67,19 @@
     MediaPlayer::ReadyState readyState() const override;
     void setReadyState(MediaPlayer::ReadyState) override;
 
-    void flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>>, AtomicString) override { }
+    void flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>>, AtomicString) override { m_enqueuedSamples.clear(); }
     void enqueueSample(PassRefPtr<MediaSample>, AtomicString) override;
     bool isReadyForMoreSamples(AtomicString) override { return true; }
     void setActive(bool) override;
 
+    Vector<String> enqueuedSamplesForTrackID(AtomicString) override;
+
     void didReceiveInitializationSegment(const MockInitializationBox&);
     void didReceiveSample(const MockSampleBox&);
 
     MockMediaSourcePrivate* m_mediaSource;
     SourceBufferPrivateClient* m_client;
+    Vector<String> m_enqueuedSamples;
 
     Vector<char> m_inputBuffer;
 };

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.cpp (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.cpp	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.cpp	2016-09-23 20:24:57 UTC (rev 206326)
@@ -2756,6 +2756,11 @@
     return buffer.bufferedSamplesForTrackID(trackID);
 }
     
+Vector<String> Internals::enqueuedSamplesForTrackID(SourceBuffer& buffer, const AtomicString& trackID)
+{
+    return buffer.enqueuedSamplesForTrackID(trackID);
+}
+
 void Internals::setShouldGenerateTimestamps(SourceBuffer& buffer, bool flag)
 {
     buffer.setShouldGenerateTimestamps(flag);

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.h (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.h	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.h	2016-09-23 20:24:57 UTC (rev 206326)
@@ -401,6 +401,7 @@
 #if ENABLE(MEDIA_SOURCE)
     WEBCORE_TESTSUPPORT_EXPORT void initializeMockMediaSource();
     Vector<String> bufferedSamplesForTrackID(SourceBuffer&, const AtomicString&);
+    Vector<String> enqueuedSamplesForTrackID(SourceBuffer&, const AtomicString&);
     void setShouldGenerateTimestamps(SourceBuffer&, bool);
 #endif
 

Modified: tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.idl (206325 => 206326)


--- tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.idl	2016-09-23 20:23:58 UTC (rev 206325)
+++ tags/Safari-603.1.6.0.2/Source/WebCore/testing/Internals.idl	2016-09-23 20:24:57 UTC (rev 206326)
@@ -392,6 +392,7 @@
 
     [Conditional=MEDIA_SOURCE] void initializeMockMediaSource();
     [Conditional=MEDIA_SOURCE] sequence<DOMString> bufferedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
+    [Conditional=MEDIA_SOURCE] sequence<DOMString> enqueuedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
     [Conditional=MEDIA_SOURCE] void setShouldGenerateTimestamps(SourceBuffer buffer, boolean flag);
 
     [Conditional=VIDEO, RaisesException] void beginMediaSessionInterruption(DOMString interruptionType);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to