<!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>[279382] 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/279382">279382</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-06-29 13:21:02 -0700 (Tue, 29 Jun 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, reverting <a href="http://trac.webkit.org/projects/webkit/changeset/279250">r279250</a>.
https://bugs.webkit.org/show_bug.cgi?id=227499

Sometimes causes YouTube audio to cut out

Reverted changeset:

"[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis'
appended to a SampleBuffer are not played"
https://bugs.webkit.org/show_bug.cgi?id=226069
https://commits.webkit.org/<a href="http://trac.webkit.org/projects/webkit/changeset/279250">r279250</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaSourceBufferParserWebMcpp">trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/LayoutTests/platform/mac/media/media-source/content/</li>
<li><a href="#trunkLayoutTestsplatformmacmediamediasourcemediavorbispartialexpectedtxt">trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacmediamediasourcemediavorbispartialhtml">trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (279381 => 279382)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-06-29 19:27:13 UTC (rev 279381)
+++ trunk/LayoutTests/ChangeLog 2021-06-29 20:21:02 UTC (rev 279382)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2021-06-29  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, reverting r279250.
+        https://bugs.webkit.org/show_bug.cgi?id=227499
+
+        Sometimes causes YouTube audio to cut out
+
+        Reverted changeset:
+
+        "[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis'
+        appended to a SampleBuffer are not played"
+        https://bugs.webkit.org/show_bug.cgi?id=226069
+        https://commits.webkit.org/r279250
+
</ins><span class="cx"> 2021-06-29  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (279381 => 279382)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations  2021-06-29 19:27:13 UTC (rev 279381)
+++ trunk/LayoutTests/platform/mac/TestExpectations     2021-06-29 20:21:02 UTC (rev 279382)
</span><span class="lines">@@ -1771,9 +1771,6 @@
</span><span class="cx"> [ Catalina Mojave ] platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html [ Skip ]
</span><span class="cx"> [ Catalina Mojave ] platform/mac/media/media-source/is-type-supported-vp9-codec-check.html [ Skip ]
</span><span class="cx"> 
</span><del>-# These tests require macOS Monterey.
-[ Catalina Mojave BigSur ] platform/mac/media/media-source/media-vorbis-partial.html [ Skip ]
-
</del><span class="cx"> webkit.org/b/214422 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/suspend-after-construct.html [ Pass Failure ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/214498 imported/w3c/web-platform-tests/cors/remote-origin.htm [ Pass ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacmediamediasourcemediavorbispartialexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial-expected.txt (279381 => 279382)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial-expected.txt      2021-06-29 19:27:13 UTC (rev 279381)
+++ trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial-expected.txt 2021-06-29 20:21:02 UTC (rev 279382)
</span><span class="lines">@@ -1,12 +0,0 @@
</span><del>-
-RUN(video.src = URL.createObjectURL(source))
-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)
-EXPECTED (sourceBuffer.buffered.end(0) == source.duration == 'true') OK
-END OF TEST
</del></span></pre></div>
<a id="trunkLayoutTestsplatformmacmediamediasourcemediavorbispartialhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial.html (279381 => 279382)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial.html      2021-06-29 19:27:13 UTC (rev 279381)
+++ trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial.html 2021-06-29 20:21:02 UTC (rev 279382)
</span><span class="lines">@@ -1,51 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-    <title>media-vorbis-partial</title>
-    <script src="../../../../media/media-source/media-source-loader.js"></script>
-    <script src="../../../../media/video-test.js"></script>
-    <script>
-    var loader;
-    var source;
-    var sourceBuffer;
-
-    function loaderPromise(loader) {
-        return new Promise((resolve, reject) => {
-            loader.onload = resolve;
-            loader.onerror = reject;
-        });
-    }
-
-    window.addEventListener('load', async event => {
-        try {
-            findMediaElement();
-            loader = new MediaSourceLoader('content/test-vorbis-manifest.json');
-            await loaderPromise(loader);
-
-            source = new MediaSource();
-            run('video.src = URL.createObjectURL(source)');
-            await waitFor(source, 'sourceopen');
-            waitFor(video, 'error').then(failTest);
-
-            run('source.duration = loader.duration()');
-            run('sourceBuffer = source.addSourceBuffer(loader.type())');
-            run('sourceBuffer.appendBuffer(loader.initSegment())');
-            await waitFor(sourceBuffer, 'update');
-
-            consoleWrite('Append a media segment.')
-            run('sourceBuffer.appendBuffer(loader.mediaSegment(0))');
-            await waitFor(sourceBuffer, 'update');
-
-            testExpected('sourceBuffer.buffered.end(0) == source.duration', true);
-
-            endTest();
-        } catch (e) {
-            failTest(`Caught exception: "${e}"`);
-        }
-    });
-    </script>
-</head>
-<body>
-    <video controls></video>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (279381 => 279382)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-06-29 19:27:13 UTC (rev 279381)
+++ trunk/Source/WebCore/ChangeLog      2021-06-29 20:21:02 UTC (rev 279382)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2021-06-29  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, reverting r279250.
+        https://bugs.webkit.org/show_bug.cgi?id=227499
+
+        Sometimes causes YouTube audio to cut out
+
+        Reverted changeset:
+
+        "[Cocoa] Last few seconds of 'audio/webm; codecs=vorbis'
+        appended to a SampleBuffer are not played"
+        https://bugs.webkit.org/show_bug.cgi?id=226069
+        https://commits.webkit.org/r279250
+
</ins><span class="cx"> 2021-06-29  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaSourceBufferParserWebMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (279381 => 279382)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp  2021-06-29 19:27:13 UTC (rev 279381)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp     2021-06-29 20:21:02 UTC (rev 279382)
</span><span class="lines">@@ -284,13 +284,10 @@
</span><span class="cx">     Status Read(std::size_t numToRead, uint8_t* outputBuffer, uint64_t* numActuallyRead) final
</span><span class="cx">     {
</span><span class="cx">         ASSERT(outputBuffer && numActuallyRead);
</span><del>-        if (!numActuallyRead)
</del><ins>+        if (!outputBuffer || !numActuallyRead)
</ins><span class="cx">             return Status(Status::kNotEnoughMemory);
</span><span class="cx"> 
</span><span class="cx">         *numActuallyRead = 0;
</span><del>-        if (!outputBuffer)
-            return Status(Status::kNotEnoughMemory);
-
</del><span class="cx">         while (numToRead && m_currentSegment != m_data.end()) {
</span><span class="cx">             auto& currentSegment = *m_currentSegment;
</span><span class="cx"> 
</span><span class="lines">@@ -629,12 +626,6 @@
</span><span class="cx">         m_status = m_parser->Feed(this, &m_reader);
</span><span class="cx">         if (m_status.ok() || m_status.code == Status::kEndOfFile || m_status.code == Status::kWouldBlock) {
</span><span class="cx">             m_reader->reclaimSegments();
</span><del>-
-            // Audio tracks are grouped into meta-samples of a duration no more than m_minimumSampleDuration.
-            // But at the end of a file, no more audio data may be incoming, so flush and emit any pending
-            // audio buffers.
-            flushPendingAudioBuffers();
-
</del><span class="cx">             completionHandler();
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -1226,17 +1217,16 @@
</span><span class="cx">     ASSERT(sampleCount);
</span><span class="cx"> 
</span><span class="cx">     if (m_packetDescriptions.isEmpty()) {
</span><del>-        m_packetBytesRead = m_partialBytesRead;
</del><ins>+        m_packetBytesRead = 0;
</ins><span class="cx">         m_byteOffset = metadata.position;
</span><span class="cx">         m_samplePresentationTime = presentationTime;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!m_currentPacketSize)
</del><ins>+    if (!m_currentPacketSize) {
</ins><span class="cx">         m_currentPacketSize = metadata.size;
</span><ins>+        m_packetData.grow(m_packetData.size() + metadata.size);
+    }
</ins><span class="cx"> 
</span><del>-    if (m_packetData.size() < m_packetBytesRead + metadata.size)
-        m_packetData.grow(m_packetBytesRead + metadata.size);
-
</del><span class="cx">     if (!m_currentPacketByteOffset)
</span><span class="cx">         m_currentPacketByteOffset = m_packetBytesRead;
</span><span class="cx"> 
</span><span class="lines">@@ -1257,9 +1247,6 @@
</span><span class="cx">             return status;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (!status.ok())
-            return status;
-
</del><span class="cx">         m_partialBytesRead = 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1334,10 +1321,8 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!m_packetData.isEmpty());
</span><span class="cx"> 
</span><del>-    auto fullPacketBytesRead = m_packetBytesRead - m_partialBytesRead;
-
</del><span class="cx">     CMBlockBufferRef blockBuffer = nullptr;
</span><del>-    auto err = PAL::CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, nullptr, fullPacketBytesRead, kCFAllocatorDefault, nullptr, 0, fullPacketBytesRead, kCMBlockBufferAssureMemoryNowFlag, &blockBuffer);
</del><ins>+    auto err = PAL::CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, nullptr, m_packetData.sizeInBytes(), kCFAllocatorDefault, nullptr, 0, m_packetData.sizeInBytes(), kCMBlockBufferAssureMemoryNowFlag, &blockBuffer);
</ins><span class="cx">     if (err) {
</span><span class="cx">         PARSER_LOG_ERROR_IF_POSSIBLE("CMBlockBufferCreateWithMemoryBlock failed with %d", err);
</span><span class="cx">         return;
</span><span class="lines">@@ -1344,7 +1329,7 @@
</span><span class="cx">     }
</span><span class="cx">     auto buffer = adoptCF(blockBuffer);
</span><span class="cx"> 
</span><del>-    err = PAL::CMBlockBufferReplaceDataBytes(m_packetData.data(), buffer.get(), 0, fullPacketBytesRead);
</del><ins>+    err = PAL::CMBlockBufferReplaceDataBytes(m_packetData.data(), buffer.get(), 0, m_packetData.sizeInBytes());
</ins><span class="cx">     if (err) {
</span><span class="cx">         PARSER_LOG_ERROR_IF_POSSIBLE("CMBlockBufferReplaceDataBytes failed with %d", err);
</span><span class="cx">         return;
</span><span class="lines">@@ -1358,7 +1343,7 @@
</span><span class="cx">     }
</span><span class="cx">     auto sampleBuffer = adoptCF(rawSampleBuffer);
</span><span class="cx"> 
</span><del>-    m_packetData.remove(0, fullPacketBytesRead);
</del><ins>+    m_packetData.clear();
</ins><span class="cx">     m_packetDescriptions.clear();
</span><span class="cx"> 
</span><span class="cx">     auto trackID = track().track_uid.value();
</span></span></pre>
</div>
</div>

</body>
</html>