Title: [274657] trunk/Source/WebCore
Revision
274657
Author
cdu...@apple.com
Date
2021-03-18 11:48:11 -0700 (Thu, 18 Mar 2021)

Log Message

Avoid heap allocations under AudioSampleDataSource::pullSamplesInternal()
https://bugs.webkit.org/show_bug.cgi?id=223449

Reviewed by Jer Noble.

AudioSampleDataSource::pullSamplesInternal() was doing heap allocations on the audio thread,
just for logging purposes (RunLoop::dispatch() & Function constructor do heap allocations).
Drop this logging to address the issue, after clearing this with Jer Noble.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274656 => 274657)


--- trunk/Source/WebCore/ChangeLog	2021-03-18 18:45:16 UTC (rev 274656)
+++ trunk/Source/WebCore/ChangeLog	2021-03-18 18:48:11 UTC (rev 274657)
@@ -1,5 +1,19 @@
 2021-03-18  Chris Dumez  <cdu...@apple.com>
 
+        Avoid heap allocations under AudioSampleDataSource::pullSamplesInternal()
+        https://bugs.webkit.org/show_bug.cgi?id=223449
+
+        Reviewed by Jer Noble.
+
+        AudioSampleDataSource::pullSamplesInternal() was doing heap allocations on the audio thread,
+        just for logging purposes (RunLoop::dispatch() & Function constructor do heap allocations).
+        Drop this logging to address the issue, after clearing this with Jer Noble.
+
+        * platform/audio/cocoa/AudioSampleDataSource.mm:
+        (WebCore::AudioSampleDataSource::pullSamplesInternal):
+
+2021-03-18  Chris Dumez  <cdu...@apple.com>
+
         Avoid heap allocation under PannerNode::pullInputs()
         https://bugs.webkit.org/show_bug.cgi?id=223445
 

Modified: trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataSource.mm (274656 => 274657)


--- trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataSource.mm	2021-03-18 18:45:16 UTC (rev 274656)
+++ trunk/Source/WebCore/platform/audio/cocoa/AudioSampleDataSource.mm	2021-03-18 18:48:11 UTC (rev 274657)
@@ -239,18 +239,11 @@
 
         m_outputSampleOffset = (endFrame - sampleCount) - timeStamp;
         m_outputSampleOffset -= computeOffsetDelay(m_outputDescription->sampleRate(), m_lastPushedSampleCount);
-        RunLoop::main().dispatch([logIdentifier = LOGIDENTIFIER, outputSampleOffset = m_outputSampleOffset, this, protectedThis = makeRefPtr(*this)] {
-            ALWAYS_LOG(logIdentifier, "setting new offset to ", outputSampleOffset);
-        });
     }
 
     timeStamp += m_outputSampleOffset;
 
     if (timeStamp < startFrame || timeStamp + sampleCount > endFrame) {
-        RunLoop::main().dispatch([logIdentifier = LOGIDENTIFIER, timeStamp, startFrame, endFrame, sampleCount, outputSampleOffset = m_outputSampleOffset, this, protectedThis = makeRefPtr(*this)] {
-            ERROR_LOG(logIdentifier, "not enough data, sample ", timeStamp, " with offset ", outputSampleOffset, ", trying to get ", sampleCount, " samples, but not completely in range [", startFrame, " .. ", endFrame, "]");
-        });
-
         if (timeStamp < startFrame || timeStamp >= endFrame) {
             // We are out of the window, let's restart the offset computation.
             m_shouldComputeOutputSampleOffset = true;
@@ -260,9 +253,6 @@
         } else {
             // We are too close from endFrame, let's wait for more data to be pushed.
             m_outputSampleOffset -= sampleCount;
-            RunLoop::main().dispatch([logIdentifier = LOGIDENTIFIER, outputSampleOffset = m_outputSampleOffset, this, protectedThis = makeRefPtr(*this)] {
-                ALWAYS_LOG(logIdentifier, "updating offset to ", outputSampleOffset);
-            });
         }
         AudioSampleBufferList::zeroABL(buffer, byteCount);
         return false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to