Title: [279382] trunk
Revision
279382
Author
[email protected]
Date
2021-06-29 13:21:02 -0700 (Tue, 29 Jun 2021)

Log Message

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

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (279381 => 279382)


--- trunk/LayoutTests/ChangeLog	2021-06-29 19:27:13 UTC (rev 279381)
+++ trunk/LayoutTests/ChangeLog	2021-06-29 20:21:02 UTC (rev 279382)
@@ -1,3 +1,17 @@
+2021-06-29  Commit Queue  <[email protected]>
+
+        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
+
 2021-06-29  Alex Christensen  <[email protected]>
 
         xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox

Modified: trunk/LayoutTests/platform/mac/TestExpectations (279381 => 279382)


--- 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)
@@ -1771,9 +1771,6 @@
 [ Catalina Mojave ] platform/mac/media/mediacapabilities/vp9-decodingInfo-sw.html [ Skip ]
 [ Catalina Mojave ] platform/mac/media/media-source/is-type-supported-vp9-codec-check.html [ Skip ]
 
-# These tests require macOS Monterey.
-[ Catalina Mojave BigSur ] platform/mac/media/media-source/media-vorbis-partial.html [ Skip ]
-
 webkit.org/b/214422 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/suspend-after-construct.html [ Pass Failure ]
 
 webkit.org/b/214498 imported/w3c/web-platform-tests/cors/remote-origin.htm [ Pass ]

Deleted: trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial-expected.txt (279381 => 279382)


--- 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)
@@ -1,12 +0,0 @@
-
-RUN(video.src = ""
-EVENT(sourceopen)
-RUN(source.duration = loader.duration())
-RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
-RUN(sourceBuffer.appendBuffer(loader.initSegment()))
-EVENT(update)
-Append a media segment.
-RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0)))
-EVENT(update)
-EXPECTED (sourceBuffer.buffered.end(0) == source.duration == 'true') OK
-END OF TEST

Deleted: trunk/LayoutTests/platform/mac/media/media-source/media-vorbis-partial.html (279381 => 279382)


--- 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)
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>media-vorbis-partial</title>
-    <script src=""
-    <script src=""
-    <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 = ""
-            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>

Modified: trunk/Source/WebCore/ChangeLog (279381 => 279382)


--- 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)
@@ -1,3 +1,17 @@
+2021-06-29  Commit Queue  <[email protected]>
+
+        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
+
 2021-06-29  Alex Christensen  <[email protected]>
 
         xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox

Modified: trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp (279381 => 279382)


--- 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)
@@ -284,13 +284,10 @@
     Status Read(std::size_t numToRead, uint8_t* outputBuffer, uint64_t* numActuallyRead) final
     {
         ASSERT(outputBuffer && numActuallyRead);
-        if (!numActuallyRead)
+        if (!outputBuffer || !numActuallyRead)
             return Status(Status::kNotEnoughMemory);
 
         *numActuallyRead = 0;
-        if (!outputBuffer)
-            return Status(Status::kNotEnoughMemory);
-
         while (numToRead && m_currentSegment != m_data.end()) {
             auto& currentSegment = *m_currentSegment;
 
@@ -629,12 +626,6 @@
         m_status = m_parser->Feed(this, &m_reader);
         if (m_status.ok() || m_status.code == Status::kEndOfFile || m_status.code == Status::kWouldBlock) {
             m_reader->reclaimSegments();
-
-            // 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();
-
             completionHandler();
             return;
         }
@@ -1226,17 +1217,16 @@
     ASSERT(sampleCount);
 
     if (m_packetDescriptions.isEmpty()) {
-        m_packetBytesRead = m_partialBytesRead;
+        m_packetBytesRead = 0;
         m_byteOffset = metadata.position;
         m_samplePresentationTime = presentationTime;
     }
 
-    if (!m_currentPacketSize)
+    if (!m_currentPacketSize) {
         m_currentPacketSize = metadata.size;
+        m_packetData.grow(m_packetData.size() + metadata.size);
+    }
 
-    if (m_packetData.size() < m_packetBytesRead + metadata.size)
-        m_packetData.grow(m_packetBytesRead + metadata.size);
-
     if (!m_currentPacketByteOffset)
         m_currentPacketByteOffset = m_packetBytesRead;
 
@@ -1257,9 +1247,6 @@
             return status;
         }
 
-        if (!status.ok())
-            return status;
-
         m_partialBytesRead = 0;
     }
 
@@ -1334,10 +1321,8 @@
 
     ASSERT(!m_packetData.isEmpty());
 
-    auto fullPacketBytesRead = m_packetBytesRead - m_partialBytesRead;
-
     CMBlockBufferRef blockBuffer = nullptr;
-    auto err = PAL::CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, nullptr, fullPacketBytesRead, kCFAllocatorDefault, nullptr, 0, fullPacketBytesRead, kCMBlockBufferAssureMemoryNowFlag, &blockBuffer);
+    auto err = PAL::CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, nullptr, m_packetData.sizeInBytes(), kCFAllocatorDefault, nullptr, 0, m_packetData.sizeInBytes(), kCMBlockBufferAssureMemoryNowFlag, &blockBuffer);
     if (err) {
         PARSER_LOG_ERROR_IF_POSSIBLE("CMBlockBufferCreateWithMemoryBlock failed with %d", err);
         return;
@@ -1344,7 +1329,7 @@
     }
     auto buffer = adoptCF(blockBuffer);
 
-    err = PAL::CMBlockBufferReplaceDataBytes(m_packetData.data(), buffer.get(), 0, fullPacketBytesRead);
+    err = PAL::CMBlockBufferReplaceDataBytes(m_packetData.data(), buffer.get(), 0, m_packetData.sizeInBytes());
     if (err) {
         PARSER_LOG_ERROR_IF_POSSIBLE("CMBlockBufferReplaceDataBytes failed with %d", err);
         return;
@@ -1358,7 +1343,7 @@
     }
     auto sampleBuffer = adoptCF(rawSampleBuffer);
 
-    m_packetData.remove(0, fullPacketBytesRead);
+    m_packetData.clear();
     m_packetDescriptions.clear();
 
     auto trackID = track().track_uid.value();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to