<!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>[178468] trunk</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/178468">178468</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-01-14 17:16:42 -0800 (Wed, 14 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/178438">r178438</a>.
https://bugs.webkit.org/show_bug.cgi?id=140484

Broke a few MediaSource tests (Requested by JoePeck on
#webkit).

Reverted changeset:

&quot;[MSE] Implement per TrackBuffer buffered.&quot;
https://bugs.webkit.org/show_bug.cgi?id=139813
http://trac.webkit.org/changeset/178438</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceMediaSourcecpp">trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceSourceBuffercpp">trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceSourceBufferh">trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedexpectedtxt">trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedinendedstateexpectedtxt">trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedinendedstatehtml">trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state.html</a></li>
<li><a href="#trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedhtml">trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/LayoutTests/ChangeLog        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-01-14  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r178438.
+        https://bugs.webkit.org/show_bug.cgi?id=140484
+
+        Broke a few MediaSource tests (Requested by JoePeck on
+        #webkit).
+
+        Reverted changeset:
+
+        &quot;[MSE] Implement per TrackBuffer buffered.&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=139813
+        http://trac.webkit.org/changeset/178438
+
</ins><span class="cx"> 2015-01-14  Enrica Casucci  &lt;enrica@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r165385): Crash when applying autocorrection exceeds maximum text area length.
</span></span></pre></div>
<a id="trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-expected.txt (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-expected.txt        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-expected.txt        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -1,21 +0,0 @@
</span><del>-
-RUN(video.src = URL.createObjectURL(source))
-RUN(sourceBuffer.appendBuffer(init);)
-EVENT(updateend)
-RUN(sourceBuffer.appendBuffer(samples))
-EVENT(updateend)
-EXPECTED (sourceBuffer.buffered.length == '0') OK
-RUN(sourceBuffer.appendBuffer(samples))
-EVENT(updateend)
-EXPECTED (sourceBuffer.buffered.length == '1') OK
-EXPECTED (sourceBuffer.buffered.end(0).toFixed(3) == '3') OK
-RUN(sourceBuffer.appendBuffer(samples))
-EVENT(updateend)
-EXPECTED (sourceBuffer.buffered.length == '1') OK
-EXPECTED (sourceBuffer.buffered.end(0).toFixed(3) == '6') OK
-RUN(sourceBuffer.remove(0, 2.5))
-EVENT(updateend)
-EXPECTED (sourceBuffer.buffered.length == '1') OK
-EXPECTED (sourceBuffer.buffered.start(0).toFixed(3) == '3') OK
-END OF TEST
-
</del></span></pre></div>
<a id="trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedinendedstateexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state-expected.txt (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state-expected.txt        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state-expected.txt        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -1,28 +0,0 @@
</span><del>-
-RUN(video.src = URL.createObjectURL(source))
-EXPECTED (sourceBuffer.updating == 'false') OK
-RUN(sourceBuffer.appendBuffer(init);)
-EVENT(updateend)
-RUN(sourceBuffer.appendBuffer(samples))
-EVENT(updateend)
-EXPECTED (sourceBuffer.buffered.length == '0') OK
-RUN(sourceBuffer.appendBuffer(samples))
-EVENT(updateend)
-EXPECTED (sourceBuffer.buffered.length == '1') OK
-EXPECTED (sourceBuffer.buffered.start(0).toFixed(3) == '3') OK
-EXPECTED (sourceBuffer.buffered.end(0).toFixed(3) == '4') OK
-RUN(source.endOfStream())
-EVENT(sourceended)
-EXPECTED (source.readyState == 'ended') OK
-EXPECTED (sourceBuffer.buffered.length == '2') OK
-EXPECTED (sourceBuffer.buffered.start(1).toFixed(3) == '7') OK
-EXPECTED (sourceBuffer.buffered.end(1).toFixed(3) == '10') OK
-EVENT(updateend)
-EXPECTED (source.readyState == 'ended') OK
-RUN(sourceBuffer.timestampOffset = 0;)
-EXPECTED (source.readyState == 'open') OK
-EXPECTED (sourceBuffer.buffered.length == '1') OK
-EXPECTED (sourceBuffer.buffered.start(0).toFixed(3) == '3') OK
-EXPECTED (sourceBuffer.buffered.end(0).toFixed(3) == '4') OK
-END OF TEST
-
</del></span></pre></div>
<a id="trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedinendedstatehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state.html (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state.html        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered-in-ended-state.html        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -1,95 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;title&gt;mock-media-source&lt;/title&gt;
-    &lt;script src=&quot;mock-media-source.js&quot;&gt;&lt;/script&gt;
-    &lt;script src=&quot;../video-test.js&quot;&gt;&lt;/script&gt;
-    &lt;script&gt;
-    var source;
-    var sourceBuffer;
-    var init;
-    var samples;
-
-    if (window.internals)
-        internals.initializeMockMediaSource();
-
-    function runTest() {
-        findMediaElement();
-        source = new MediaSource();
-        source.addEventListener('sourceopen', startLoad);
-        run('video.src = URL.createObjectURL(source)');
-    }
-
-    function startLoad() {
-        sourceBuffer = source.addSourceBuffer('video/mock; codecs=&quot;mock&quot;');
-        waitForEventOn(sourceBuffer, 'updateend', loadSamples1, false, true);
-
-        // Make an init segment with 1 video track and 1 audio track
-        init = makeAInit(0, [
-            makeATrack(1, 'mock', TRACK_KIND.VIDEO),
-            makeATrack(2, 'mock', TRACK_KIND.AUDIO),
-            ]);
-        testExpected('sourceBuffer.updating', false);
-        run('sourceBuffer.appendBuffer(init);');
-    }
-
-    function loadSamples1() {
-        samples = concatenateSamples([
-            makeASample(3, 3, 1, 1, SAMPLE_FLAG.SYNC),
-            makeASample(4, 4, 1, 1, SAMPLE_FLAG.NONE),
-            makeASample(5, 5, 1, 1, SAMPLE_FLAG.NONE),
-        ]);
-        waitForEventOn(sourceBuffer, 'updateend', loadSamples2, false, true);
-        run('sourceBuffer.appendBuffer(samples)');
-    }
-
-    function loadSamples2() {
-        testExpected('sourceBuffer.buffered.length', 0);
-
-        samples = concatenateSamples([
-            makeASample(0, 0, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(1, 1, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(2, 2, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(3, 3, 1, 2, SAMPLE_FLAG.SYNC),
-
-            makeASample(7, 7, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(8, 8, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(9, 9, 1, 2, SAMPLE_FLAG.SYNC),
-        ]);
-        waitForEventOn(sourceBuffer, 'updateend', loadSamples3, false, true);
-        run('sourceBuffer.appendBuffer(samples)');
-    }
-
-    function loadSamples3() {
-        testExpected('sourceBuffer.buffered.length', 1);
-        testExpected('sourceBuffer.buffered.start(0).toFixed(3)', 3);
-        testExpected('sourceBuffer.buffered.end(0).toFixed(3)', 4);
-
-        waitForEventOn(source, 'sourceended', ended, false, true);
-        waitForEventOn(sourceBuffer, 'updateend', finishTest, false, true);
-        run('source.endOfStream()');
-    }
-
-    function ended() {
-        testExpected('source.readyState', &quot;ended&quot;);
-        testExpected('sourceBuffer.buffered.length', 2);
-        testExpected('sourceBuffer.buffered.start(1).toFixed(3)', 7);
-        testExpected('sourceBuffer.buffered.end(1).toFixed(3)', 10);
-    }
-
-    function finishTest() {
-        testExpected('source.readyState', &quot;ended&quot;);
-        run('sourceBuffer.timestampOffset = 0;'); // this opens MediaSource
-        testExpected('source.readyState', &quot;open&quot;);
-        testExpected('sourceBuffer.buffered.length', 1);
-        testExpected('sourceBuffer.buffered.start(0).toFixed(3)', 3);
-        testExpected('sourceBuffer.buffered.end(0).toFixed(3)', 4);
-        endTest();
-    }
-
-    &lt;/script&gt;
-&lt;/head&gt;
-&lt;body onload=&quot;runTest()&quot;&gt;
-    &lt;video&gt;&lt;/video&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsmediamediasourcemediasourcemultipletrackBuffersbufferedhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered.html (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered.html        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/LayoutTests/media/media-source/media-source-multiple-trackBuffers-buffered.html        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -1,97 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;title&gt;mock-media-source&lt;/title&gt;
-    &lt;script src=&quot;mock-media-source.js&quot;&gt;&lt;/script&gt;
-    &lt;script src=&quot;../video-test.js&quot;&gt;&lt;/script&gt;
-    &lt;script&gt;
-    var source;
-    var sourceBuffer;
-    var init;
-    var samples;
-
-    if (window.internals)
-        internals.initializeMockMediaSource();
-
-    function runTest() {
-        findMediaElement();
-        source = new MediaSource();
-        source.addEventListener('sourceopen', startLoad);
-        run('video.src = URL.createObjectURL(source)');
-    }
-
-    function startLoad() {
-        sourceBuffer = source.addSourceBuffer('video/mock; codecs=&quot;mock&quot;');
-        waitForEventOn(sourceBuffer, 'updateend', loadSamples1, false, true);
-
-        // Make an init segment with 1 video track and 1 audio track
-        init = makeAInit(0, [
-            makeATrack(1, 'mock', TRACK_KIND.VIDEO),
-            makeATrack(2, 'mock', TRACK_KIND.AUDIO),
-            ]);
-        run('sourceBuffer.appendBuffer(init);');
-    }
-
-    function loadSamples1() {
-        samples = concatenateSamples([
-            makeASample(0, 0, 1, 1, SAMPLE_FLAG.SYNC),
-            makeASample(1, 1, 1, 1, SAMPLE_FLAG.NONE),
-            makeASample(2, 2, 1, 1, SAMPLE_FLAG.NONE),
-            makeASample(3, 3, 1, 1, SAMPLE_FLAG.SYNC),
-            makeASample(4, 4, 1, 1, SAMPLE_FLAG.NONE),
-            makeASample(5, 5, 1, 1, SAMPLE_FLAG.NONE),
-        ]);
-        waitForEventOn(sourceBuffer, 'updateend', loadSamples2, false, true);
-        run('sourceBuffer.appendBuffer(samples)');
-    }
-
-    function loadSamples2() {
-        testExpected('sourceBuffer.buffered.length', 0);
-
-        samples = concatenateSamples([
-            makeASample(0, 0, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(1, 1, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(2, 2, 1, 2, SAMPLE_FLAG.SYNC),
-        ]);
-        waitForEventOn(sourceBuffer, 'updateend', loadSamples3, false, true);
-        run('sourceBuffer.appendBuffer(samples)');
-    }
-
-    function loadSamples3() {
-        testExpected('sourceBuffer.buffered.length', 1);
-        testExpected('sourceBuffer.buffered.end(0).toFixed(3)', 3);
-
-        samples = concatenateSamples([
-            makeASample(3, 3, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(4, 4, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(5, 5, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(6, 6, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(7, 7, 1, 2, SAMPLE_FLAG.SYNC),
-            makeASample(8, 8, 1, 2, SAMPLE_FLAG.SYNC),
-
-        ]);
-        waitForEventOn(sourceBuffer, 'updateend', removeSamples1, false, true);
-        run('sourceBuffer.appendBuffer(samples)');
-    }
-
-
-    function removeSamples1() {
-        testExpected('sourceBuffer.buffered.length', 1);
-        testExpected('sourceBuffer.buffered.end(0).toFixed(3)', 6);
-
-        waitForEventOn(sourceBuffer, 'updateend', doEnd, false, true);
-        run('sourceBuffer.remove(0, 2.5)');
-    }
-
-    function doEnd() {
-        testExpected('sourceBuffer.buffered.length', 1);
-        testExpected('sourceBuffer.buffered.start(0).toFixed(3)', 3);
-        endTest();
-    }
-
-    &lt;/script&gt;
-&lt;/head&gt;
-&lt;body onload=&quot;runTest()&quot;&gt;
-    &lt;video&gt;&lt;/video&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/Source/WebCore/ChangeLog        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-01-14  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r178438.
+        https://bugs.webkit.org/show_bug.cgi?id=140484
+
+        Broke a few MediaSource tests (Requested by JoePeck on
+        #webkit).
+
+        Reverted changeset:
+
+        &quot;[MSE] Implement per TrackBuffer buffered.&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=139813
+        http://trac.webkit.org/changeset/178438
+
</ins><span class="cx"> 2015-01-14  Enrica Casucci  &lt;enrica@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r165385): Crash when applying autocorrection exceeds maximum text area length.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceMediaSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -405,9 +405,6 @@
</span><span class="cx">     m_readyState = state;
</span><span class="cx"> 
</span><span class="cx">     onReadyStateChange(oldState, state);
</span><del>-
-    for (auto&amp; sourceBuffer : *m_sourceBuffers)
-        sourceBuffer-&gt;invalidateBuffered();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool SourceBufferIsUpdating(RefPtr&lt;SourceBuffer&gt;&amp; sourceBuffer)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceSourceBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -89,7 +89,6 @@
</span><span class="cx">     MediaTime highestPresentationTimestamp;
</span><span class="cx">     MediaTime lastEnqueuedPresentationTime;
</span><span class="cx">     MediaTime lastEnqueuedDecodeEndTime;
</span><del>-    RefPtr&lt;TimeRanges&gt; m_buffered;
</del><span class="cx">     bool needRandomAccessFlag;
</span><span class="cx">     bool enabled;
</span><span class="cx">     bool needsReenqueueing;
</span><span class="lines">@@ -103,7 +102,6 @@
</span><span class="cx">         , highestPresentationTimestamp(MediaTime::invalidTime())
</span><span class="cx">         , lastEnqueuedPresentationTime(MediaTime::invalidTime())
</span><span class="cx">         , lastEnqueuedDecodeEndTime(MediaTime::invalidTime())
</span><del>-        , m_buffered(TimeRanges::create())
</del><span class="cx">         , needRandomAccessFlag(true)
</span><span class="cx">         , enabled(false)
</span><span class="cx">         , needsReenqueueing(false)
</span><span class="lines">@@ -143,7 +141,6 @@
</span><span class="cx">     , m_active(false)
</span><span class="cx">     , m_bufferFull(false)
</span><span class="cx">     , m_shouldGenerateTimestamps(false)
</span><del>-    , m_shouldRecalculateBuffered(false)
</del><span class="cx"> {
</span><span class="cx">     ASSERT(m_source);
</span><span class="cx"> 
</span><span class="lines">@@ -168,68 +165,15 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Note: Steps 2-4 are handled by recalculateBuffered
-    if (m_shouldRecalculateBuffered)
-        recalculateBuffered();
-
-    // 5. Return the intersection ranges.
</del><ins>+    // 2. Return a new static normalized TimeRanges object for the media segments buffered.
</ins><span class="cx">     return m_buffered-&gt;copy();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const RefPtr&lt;TimeRanges&gt;&amp; SourceBuffer::buffered() const
</span><span class="cx"> {
</span><del>-    if (m_shouldRecalculateBuffered)
-        recalculateBuffered();
-
</del><span class="cx">     return m_buffered;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SourceBuffer::invalidateBuffered()
-{
-    m_shouldRecalculateBuffered = true;
-    // FIXME: for caching buffered in MediaSource should add here :
-    // m_source-&gt;invalidateBuffered();
-}
-
-void SourceBuffer::recalculateBuffered() const
-{
-    // Section 3.1 buffered attribute steps.
-    m_shouldRecalculateBuffered = false;
-
-    // 2. Let highest end time be the largest track buffer ranges end time across all the track buffers managed by this SourceBuffer object.
-    MediaTime highestEndTime = MediaTime::zeroTime();
-    for (auto&amp; trackBuffer : m_trackBufferMap.values()) {
-        PlatformTimeRanges&amp; trackRanges = trackBuffer.m_buffered-&gt;ranges();
-
-        if (trackRanges.length())
-            highestEndTime = std::max(highestEndTime, trackRanges.maximumBufferedTime());
-    }
-
-    // Return an empty range if all ranges are empty.
-    if (!highestEndTime) {
-        m_buffered = TimeRanges::create();
-        return;
-    }
-
-    // 3. Let intersection ranges equal a TimeRange object containing a single range from 0 to highest end time.
-    PlatformTimeRanges intersectionRanges(MediaTime::zeroTime(), highestEndTime);
-
-    // 4. For each track buffer managed by this SourceBuffer, run the following steps:
-    bool ended = m_source-&gt;readyState() == MediaSource::endedKeyword();
-    for (auto&amp; trackBuffer : m_trackBufferMap.values()) {
-        // 4.1 Let track ranges equal the track buffer ranges for the current track buffer.
-        PlatformTimeRanges trackRanges = trackBuffer.m_buffered-&gt;ranges();
-        // 4.2 If readyState is &quot;ended&quot;, then set the end time on the last range in track ranges to highest end time.
-        if (ended)
-            trackRanges.add(trackRanges.maximumBufferedTime(), highestEndTime);
-        // 4.3 Let new intersection ranges equal the intersection between the intersection ranges and the track ranges.
-        // 4.4 Replace the ranges in intersection ranges with the new intersection ranges.
-        intersectionRanges.intersectWith(trackRanges);
-    }
-
-    m_buffered = TimeRanges::create(intersectionRanges);
-}
-
</del><span class="cx"> double SourceBuffer::timestampOffset() const
</span><span class="cx"> {
</span><span class="cx">     return m_timestampOffset.toDouble();
</span><span class="lines">@@ -668,8 +612,6 @@
</span><span class="cx"> 
</span><span class="cx">     // 7. Need more data: Return control to the calling algorithm.
</span><span class="cx"> 
</span><del>-    invalidateBuffered();
-
</del><span class="cx">     // NOTE: return to Section 3.5.5
</span><span class="cx">     // 2.If the segment parser loop algorithm in the previous step was aborted, then abort this algorithm.
</span><span class="cx">     if (result != AppendSucceeded)
</span><span class="lines">@@ -703,7 +645,7 @@
</span><span class="cx">     if (extraMemoryCost() &gt; this-&gt;maximumBufferSize())
</span><span class="cx">         m_bufferFull = true;
</span><span class="cx"> 
</span><del>-    LOG(Media, &quot;SourceBuffer::sourceBufferPrivateAppendComplete(%p) - buffered = %s&quot;, this, toString(buffered()-&gt;ranges()).utf8().data());
</del><ins>+    LOG(Media, &quot;SourceBuffer::sourceBufferPrivateAppendComplete(%p) - buffered = %s&quot;, this, toString(m_buffered-&gt;ranges()).utf8().data());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SourceBuffer::sourceBufferPrivateDidReceiveRenderingError(SourceBufferPrivate*, int error)
</span><span class="lines">@@ -826,7 +768,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         erasedRanges-&gt;invert();
</span><del>-        trackBuffer.m_buffered-&gt;intersectWith(*erasedRanges);
</del><ins>+        m_buffered-&gt;intersectWith(*erasedRanges);
</ins><span class="cx"> 
</span><span class="cx">         // 3.4 If this object is in activeSourceBuffers, the current playback position is greater than or equal to start
</span><span class="cx">         // and less than the remove end timestamp, and HTMLMediaElement.readyState is greater than HAVE_METADATA, then set
</span><span class="lines">@@ -835,11 +777,10 @@
</span><span class="cx">             m_private-&gt;setReadyState(MediaPlayer::HaveMetadata);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    invalidateBuffered();
</del><span class="cx">     // 4. If buffer full flag equals true and this object is ready to accept more bytes, then set the buffer full flag to false.
</span><span class="cx">     // No-op
</span><span class="cx"> 
</span><del>-    LOG(Media, &quot;SourceBuffer::removeCodedFrames(%p) - buffered = %s&quot;, this, toString(buffered()-&gt;ranges()).utf8().data());
</del><ins>+    LOG(Media, &quot;SourceBuffer::removeCodedFrames(%p) - buffered = %s&quot;, this, toString(m_buffered-&gt;ranges()).utf8().data());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SourceBuffer::removeTimerFired()
</span><span class="lines">@@ -919,9 +860,9 @@
</span><span class="cx">     // If there still isn't enough free space and there buffers in time ranges after the current range (ie. there is a gap after
</span><span class="cx">     // the current buffered range), delete 30 seconds at a time from duration back to the current time range or 30 seconds after
</span><span class="cx">     // currenTime whichever we hit first.
</span><del>-    auto bufferedRegion = buffered()-&gt;ranges();
-    size_t currentTimeRange = bufferedRegion.find(currentTime);
-    if (currentTimeRange == notFound || currentTimeRange == bufferedRegion.length() - 1) {
</del><ins>+    auto buffered = m_buffered-&gt;ranges();
+    size_t currentTimeRange = buffered.find(currentTime);
+    if (currentTimeRange == notFound || currentTimeRange == buffered.length() - 1) {
</ins><span class="cx">         LOG(MediaSource, &quot;SourceBuffer::evictCodedFrames(%p) - evicted %zu bytes but FAILED to free enough&quot;, this, initialBufferedSize - extraMemoryCost());
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -933,13 +874,13 @@
</span><span class="cx">     while (rangeStart &gt; minimumRangeStart) {
</span><span class="cx"> 
</span><span class="cx">         // Do not evict data from the time range that contains currentTime.
</span><del>-        size_t startTimeRange = bufferedRegion.find(rangeStart);
</del><ins>+        size_t startTimeRange = buffered.find(rangeStart);
</ins><span class="cx">         if (startTimeRange == currentTimeRange) {
</span><del>-            size_t endTimeRange = bufferedRegion.find(rangeEnd);
</del><ins>+            size_t endTimeRange = buffered.find(rangeEnd);
</ins><span class="cx">             if (endTimeRange == currentTimeRange)
</span><span class="cx">                 break;
</span><span class="cx"> 
</span><del>-            rangeEnd = bufferedRegion.start(endTimeRange);
</del><ins>+            rangeEnd = buffered.start(endTimeRange);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 4. For each range in removal ranges, run the coded frame removal algorithm with start and
</span><span class="lines">@@ -1539,14 +1480,14 @@
</span><span class="cx">                 // NOTE: Searching from the end of the trackBuffer will be vastly more efficient if the search range is
</span><span class="cx">                 // near the end of the buffered range. Use a linear-backwards search if the search range is within one
</span><span class="cx">                 // frame duration of the end:
</span><del>-                if (!trackBuffer.m_buffered)
</del><ins>+                if (!m_buffered)
</ins><span class="cx">                     break;
</span><span class="cx"> 
</span><del>-                unsigned bufferedLength = trackBuffer.m_buffered-&gt;ranges().length();
</del><ins>+                unsigned bufferedLength = m_buffered-&gt;ranges().length();
</ins><span class="cx">                 if (!bufferedLength)
</span><span class="cx">                     break;
</span><span class="cx"> 
</span><del>-                MediaTime highestBufferedTime = trackBuffer.m_buffered-&gt;ranges().maximumBufferedTime();
</del><ins>+                MediaTime highestBufferedTime = m_buffered-&gt;ranges().maximumBufferedTime();
</ins><span class="cx"> 
</span><span class="cx">                 PresentationOrderSampleMap::iterator_range range;
</span><span class="cx">                 if (highestBufferedTime - trackBuffer.highestPresentationTimestamp &lt; trackBuffer.lastFrameDuration)
</span><span class="lines">@@ -1585,7 +1526,7 @@
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             erasedRanges-&gt;invert();
</span><del>-            trackBuffer.m_buffered-&gt;intersectWith(*erasedRanges);
</del><ins>+            m_buffered-&gt;intersectWith(*erasedRanges);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 1.17 If spliced audio frame is set:
</span><span class="lines">@@ -1624,7 +1565,7 @@
</span><span class="cx">         if (m_shouldGenerateTimestamps)
</span><span class="cx">             m_timestampOffset = frameEndTimestamp;
</span><span class="cx"> 
</span><del>-        trackBuffer.m_buffered-&gt;add(presentationTimestamp.toDouble(), (presentationTimestamp + frameDuration + microsecond).toDouble());
</del><ins>+        m_buffered-&gt;add(presentationTimestamp.toDouble(), (presentationTimestamp + frameDuration + microsecond).toDouble());
</ins><span class="cx">         m_bufferedSinceLastMonitor += frameDuration.toDouble();
</span><span class="cx"> 
</span><span class="cx">         break;
</span><span class="lines">@@ -1885,7 +1826,7 @@
</span><span class="cx"> std::unique_ptr&lt;PlatformTimeRanges&gt; SourceBuffer::bufferedAccountingForEndOfStream() const
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Revisit this method once the spec bug &lt;https://www.w3.org/Bugs/Public/show_bug.cgi?id=26436&gt; is resolved.
</span><del>-    std::unique_ptr&lt;PlatformTimeRanges&gt; virtualRanges = PlatformTimeRanges::create(buffered()-&gt;ranges());
</del><ins>+    std::unique_ptr&lt;PlatformTimeRanges&gt; virtualRanges = PlatformTimeRanges::create(m_buffered-&gt;ranges());
</ins><span class="cx">     if (m_source-&gt;isEnded()) {
</span><span class="cx">         MediaTime start = virtualRanges-&gt;maximumBufferedTime();
</span><span class="cx">         MediaTime end = m_source-&gt;duration();
</span><span class="lines">@@ -1897,7 +1838,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool SourceBuffer::hasCurrentTime() const
</span><span class="cx"> {
</span><del>-    if (isRemoved() || !buffered()-&gt;length())
</del><ins>+    if (isRemoved() || !m_buffered-&gt;length())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     MediaTime currentTime = m_source-&gt;currentTime();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceSourceBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h (178467 => 178468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h        2015-01-15 01:11:24 UTC (rev 178467)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h        2015-01-15 01:16:42 UTC (rev 178468)
</span><span class="lines">@@ -126,7 +126,6 @@
</span><span class="cx">     bool shouldGenerateTimestamps() const { return m_shouldGenerateTimestamps; }
</span><span class="cx">     void setShouldGenerateTimestamps(bool flag) { m_shouldGenerateTimestamps = flag; }
</span><span class="cx"> 
</span><del>-    void invalidateBuffered();
</del><span class="cx"> protected:
</span><span class="cx">     // EventTarget interface
</span><span class="cx">     virtual void refEventTarget() override { ref(); }
</span><span class="lines">@@ -186,7 +185,6 @@
</span><span class="cx"> 
</span><span class="cx">     void removeTimerFired();
</span><span class="cx">     void removeCodedFrames(const MediaTime&amp; start, const MediaTime&amp; end);
</span><del>-    void recalculateBuffered() const;
</del><span class="cx"> 
</span><span class="cx">     size_t extraMemoryCost() const;
</span><span class="cx">     void reportExtraMemoryCost();
</span><span class="lines">@@ -221,7 +219,7 @@
</span><span class="cx">     MediaTime m_groupEndTimestamp;
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;AtomicString, TrackBuffer&gt; m_trackBufferMap;
</span><del>-    mutable RefPtr&lt;TimeRanges&gt; m_buffered;
</del><ins>+    RefPtr&lt;TimeRanges&gt; m_buffered;
</ins><span class="cx"> 
</span><span class="cx">     enum AppendStateType { WaitingForSegment, ParsingInitSegment, ParsingMediaSegment };
</span><span class="cx">     AppendStateType m_appendState;
</span><span class="lines">@@ -241,7 +239,6 @@
</span><span class="cx">     bool m_active;
</span><span class="cx">     bool m_bufferFull;
</span><span class="cx">     bool m_shouldGenerateTimestamps;
</span><del>-    mutable bool m_shouldRecalculateBuffered;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>