Title: [212771] trunk/Source/WebCore
Revision
212771
Author
[email protected]
Date
2017-02-21 15:18:36 -0800 (Tue, 21 Feb 2017)

Log Message

AudioSampleDataSource doesn't need to use the m_scratchBuffer on the pulling thread
https://bugs.webkit.org/show_bug.cgi?id=168640

Reviewed by Eric Carlson.

Rather than copying the pulled data into a scratch buffer, applying a volume transformation
and then copying back out, just do the volume transformation in-place in the destination
buffer.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (212770 => 212771)


--- trunk/Source/WebCore/ChangeLog	2017-02-21 23:16:43 UTC (rev 212770)
+++ trunk/Source/WebCore/ChangeLog	2017-02-21 23:18:36 UTC (rev 212771)
@@ -1,3 +1,17 @@
+2017-02-21  Jer Noble  <[email protected]>
+
+        AudioSampleDataSource doesn't need to use the m_scratchBuffer on the pulling thread
+        https://bugs.webkit.org/show_bug.cgi?id=168640
+
+        Reviewed by Eric Carlson.
+
+        Rather than copying the pulled data into a scratch buffer, applying a volume transformation
+        and then copying back out, just do the volume transformation in-place in the destination
+        buffer.
+
+        * platform/audio/mac/AudioSampleDataSource.cpp:
+        (WebCore::AudioSampleDataSource::pullSamplesInternal):
+
 2017-02-21  Youenn Fablet  <[email protected]>
 
         [WebRTC] Implement Incoming libwebrtc audio source support.

Modified: trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm (212770 => 212771)


--- trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm	2017-02-21 23:16:43 UTC (rev 212770)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm	2017-02-21 23:18:36 UTC (rev 212771)
@@ -288,20 +288,11 @@
         }
     }
 
-    if (m_volume >= .95) {
-        m_ringBuffer->fetch(&buffer, sampleCount, timeStamp, mode == Copy ? CARingBuffer::Copy : CARingBuffer::Mix);
-        return true;
-    }
+    m_ringBuffer->fetch(&buffer, sampleCount, timeStamp, mode == Copy ? CARingBuffer::Copy : CARingBuffer::Mix);
 
-    if (m_scratchBuffer->copyFrom(*m_ringBuffer.get(), sampleCount, timeStamp, mode == Copy ? CARingBuffer::Copy : CARingBuffer::Mix)) {
-        AudioSampleBufferList::zeroABL(buffer, sampleCount);
-        return false;
-    }
+    if (m_volume < .95)
+        AudioSampleBufferList::applyGain(buffer, m_volume, m_outputDescription->format());
 
-    m_scratchBuffer->applyGain(m_volume);
-    if (m_scratchBuffer->copyTo(buffer, sampleCount))
-        AudioSampleBufferList::zeroABL(buffer, byteCount);
-
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to