Title: [267686] branches/safari-610-branch/Source/WebCore
Revision
267686
Author
[email protected]
Date
2020-09-27 13:00:50 -0700 (Sun, 27 Sep 2020)

Log Message

Cherry-pick r267530. rdar://problem/69594070

    Regression(r265280) Web Audio sources malfunction when disconnected from the audio graph
    https://bugs.webkit.org/show_bug.cgi?id=216703
    <rdar://problem/69158436>

    Reviewed by Eric Carlson.

    In case of an audio source that stops producing data, but does not end or mute the track,
    we would continuously try to read the data until getting to the end of the data.
    When reaching the end of the data, we would return silence and go back in time a little bit
    to restart playing with some margin. This allows to read just one chunk of audio until we are back to the end of data.

    We fix this by storing the end of the data counter when reaching it.
    When trying to pull some more data, we will go back in time a little bit only if some more data was added in the meantime.
    Otherwise, we just output silence.

    Covered by manual test.

    * platform/audio/mac/AudioSampleDataSource.h:
    * platform/audio/mac/AudioSampleDataSource.mm:
    (WebCore::AudioSampleDataSource::pullSamplesInternal):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267530 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (267685 => 267686)


--- branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-27 20:00:47 UTC (rev 267685)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-27 20:00:50 UTC (rev 267686)
@@ -1,5 +1,56 @@
 2020-09-27  Alan Coon  <[email protected]>
 
+        Cherry-pick r267530. rdar://problem/69594070
+
+    Regression(r265280) Web Audio sources malfunction when disconnected from the audio graph
+    https://bugs.webkit.org/show_bug.cgi?id=216703
+    <rdar://problem/69158436>
+    
+    Reviewed by Eric Carlson.
+    
+    In case of an audio source that stops producing data, but does not end or mute the track,
+    we would continuously try to read the data until getting to the end of the data.
+    When reaching the end of the data, we would return silence and go back in time a little bit
+    to restart playing with some margin. This allows to read just one chunk of audio until we are back to the end of data.
+    
+    We fix this by storing the end of the data counter when reaching it.
+    When trying to pull some more data, we will go back in time a little bit only if some more data was added in the meantime.
+    Otherwise, we just output silence.
+    
+    Covered by manual test.
+    
+    * platform/audio/mac/AudioSampleDataSource.h:
+    * platform/audio/mac/AudioSampleDataSource.mm:
+    (WebCore::AudioSampleDataSource::pullSamplesInternal):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-09-24  Youenn Fablet  <[email protected]>
+
+            Regression(r265280) Web Audio sources malfunction when disconnected from the audio graph
+            https://bugs.webkit.org/show_bug.cgi?id=216703
+            <rdar://problem/69158436>
+
+            Reviewed by Eric Carlson.
+
+            In case of an audio source that stops producing data, but does not end or mute the track,
+            we would continuously try to read the data until getting to the end of the data.
+            When reaching the end of the data, we would return silence and go back in time a little bit
+            to restart playing with some margin. This allows to read just one chunk of audio until we are back to the end of data.
+
+            We fix this by storing the end of the data counter when reaching it.
+            When trying to pull some more data, we will go back in time a little bit only if some more data was added in the meantime.
+            Otherwise, we just output silence.
+
+            Covered by manual test.
+
+            * platform/audio/mac/AudioSampleDataSource.h:
+            * platform/audio/mac/AudioSampleDataSource.mm:
+            (WebCore::AudioSampleDataSource::pullSamplesInternal):
+
+2020-09-27  Alan Coon  <[email protected]>
+
         Cherry-pick r267394. rdar://problem/69593980
 
     paper.io ad close buttons cannot be iteracted with via trackpad on iPad

Modified: branches/safari-610-branch/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h (267685 => 267686)


--- branches/safari-610-branch/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h	2020-09-27 20:00:47 UTC (rev 267685)
+++ branches/safari-610-branch/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h	2020-09-27 20:00:50 UTC (rev 267686)
@@ -114,6 +114,7 @@
     float m_volume { 1.0 };
     bool m_muted { false };
     bool m_shouldComputeOutputSampleOffset { true };
+    uint64_t m_endFrameWhenNotEnoughData { 0 };
 
 #if !RELEASE_LOG_DISABLED
     Ref<const Logger> m_logger;

Modified: branches/safari-610-branch/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm (267685 => 267686)


--- branches/safari-610-branch/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm	2020-09-27 20:00:47 UTC (rev 267685)
+++ branches/safari-610-branch/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm	2020-09-27 20:00:50 UTC (rev 267686)
@@ -232,7 +232,7 @@
 
     if (m_shouldComputeOutputSampleOffset) {
         uint64_t buffered = endFrame - startFrame;
-        if (buffered < sampleCount * 2) {
+        if (buffered < sampleCount * 2 || (m_endFrameWhenNotEnoughData && m_endFrameWhenNotEnoughData == endFrame)) {
             AudioSampleBufferList::zeroABL(buffer, byteCount);
             sampleCount = 0;
             return false;
@@ -239,6 +239,7 @@
         }
 
         m_shouldComputeOutputSampleOffset = false;
+        m_endFrameWhenNotEnoughData = 0;
 
         m_outputSampleOffset = (endFrame - sampleCount) - timeStamp;
         m_outputSampleOffset -= computeOffsetDelay(m_outputDescription->sampleRate(), m_lastPushedSampleCount);
@@ -257,6 +258,9 @@
         if (timeStamp < startFrame || timeStamp >= endFrame) {
             // We are out of the window, let's restart the offset computation.
             m_shouldComputeOutputSampleOffset = true;
+
+            if (timeStamp >= endFrame)
+                m_endFrameWhenNotEnoughData = endFrame;
         } else {
             // We are too close from endFrame, let's back up a little bit.
             uint64_t framesAvailable = endFrame - timeStamp;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to