Title: [198957] branches/safari-601.1.46-branch/Source/WebCore

Diff

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (198956 => 198957)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2016-04-01 21:40:20 UTC (rev 198956)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2016-04-01 21:44:30 UTC (rev 198957)
@@ -1,3 +1,7 @@
+2016-04-01  Matthew Hanson  <matthew_han...@apple.com>
+
+        Rollout r198903. rdar://problem/25467558
+
 2016-03-31  Matthew Hanson  <matthew_han...@apple.com>
 
         Roll out r191180. rdar://problem/25449273

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/AudioBus.cpp (198956 => 198957)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/AudioBus.cpp	2016-04-01 21:40:20 UTC (rev 198956)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/AudioBus.cpp	2016-04-01 21:44:30 UTC (rev 198957)
@@ -213,33 +213,6 @@
         channel(i)->scale(scale);
 }
 
-void AudioBus::copyFromRange(const AudioBus& sourceBus, unsigned startFrame, unsigned endFrame)
-{
-    if (!topologyMatches(sourceBus)) {
-        ASSERT_NOT_REACHED();
-        zero();
-        return;
-    }
-
-    size_t numberOfSourceFrames = sourceBus.length();
-    bool isRangeSafe = startFrame < endFrame && endFrame <= numberOfSourceFrames;
-    ASSERT(isRangeSafe);
-    if (!isRangeSafe) {
-        zero();
-        return;
-    }
-
-    unsigned numberOfChannels = this->numberOfChannels();
-    ASSERT(numberOfChannels <= MaxBusChannels);
-    if (numberOfChannels > MaxBusChannels) {
-        zero();
-        return;
-    }
-
-    for (unsigned i = 0; i < numberOfChannels; ++i)
-        channel(i)->copyFromRange(sourceBus.channel(i), startFrame, endFrame);
-}
-
 void AudioBus::copyFrom(const AudioBus& sourceBus, ChannelInterpretation channelInterpretation)
 {
     if (&sourceBus == this)

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/AudioBus.h (198956 => 198957)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/AudioBus.h	2016-04-01 21:40:20 UTC (rev 198956)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/AudioBus.h	2016-04-01 21:44:30 UTC (rev 198957)
@@ -122,9 +122,6 @@
     void reset() { m_isFirstTime = true; } // for de-zippering
 
     // Copies the samples from the source bus to this one.
-    void copyFromRange(const AudioBus& sourceBus, unsigned startFrame, unsigned endFrame);
-
-    // Copies the samples from the source bus to this one.
     // This is just a simple per-channel copy if the number of channels match, otherwise an up-mix or down-mix is done.
     void copyFrom(const AudioBus& sourceBus, ChannelInterpretation = Speakers);
 

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.cpp (198956 => 198957)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.cpp	2016-04-01 21:40:20 UTC (rev 198956)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.cpp	2016-04-01 21:44:30 UTC (rev 198957)
@@ -100,7 +100,6 @@
     : m_outputUnit(0)
     , m_callback(callback)
     , m_renderBus(AudioBus::create(2, kRenderBufferSize, false))
-    , m_spareBus(AudioBus::create(2, kRenderBufferSize, true))
     , m_sampleRate(sampleRate)
     , m_isPlaying(false)
 {
@@ -199,47 +198,19 @@
         setIsPlaying(false);
 }
 
-static void assignAudioBuffersToBus(AudioBuffer* buffers, AudioBus& bus, UInt32 numberOfBuffers, UInt32 numberOfFrames, UInt32 frameOffset, UInt32 framesThisTime)
-{
-    for (UInt32 i = 0; i < numberOfBuffers; ++i) {
-        UInt32 bytesPerFrame = buffers[i].mDataByteSize / numberOfFrames;
-        UInt32 byteOffset = frameOffset * bytesPerFrame;
-        float* memory = reinterpret_cast<float*>(reinterpret_cast<char*>(buffers[i].mData) + byteOffset);
-        bus.setChannelMemory(i, memory, framesThisTime);
-    }
-}
-
 // Pulls on our provider to get rendered audio stream.
 OSStatus AudioDestinationIOS::render(UInt32 numberOfFrames, AudioBufferList* ioData)
 {
     AudioBuffer* buffers = ioData->mBuffers;
-    UInt32 numberOfBuffers = ioData->mNumberBuffers;
-    UInt32 framesRemaining = numberOfFrames;
-    UInt32 frameOffset = 0;
-    while (framesRemaining > 0) {
-        if (m_firstSpareFrame && m_lastSpareFrame) {
-            ASSERT(m_firstSpareFrame < m_lastSpareFrame);
-            UInt32 framesThisTime = m_lastSpareFrame - m_firstSpareFrame;
-            assignAudioBuffersToBus(buffers, *m_renderBus, numberOfBuffers, numberOfFrames, frameOffset, framesThisTime);
-            m_renderBus->copyFromRange(*m_spareBus, m_firstSpareFrame, m_lastSpareFrame);
-            frameOffset += framesThisTime;
-            framesRemaining -= framesThisTime;
-            m_firstSpareFrame = 0;
-            m_lastSpareFrame = 0;
+    for (UInt32 frameOffset = 0; frameOffset + kRenderBufferSize <= numberOfFrames; frameOffset += kRenderBufferSize) {
+        UInt32 remainingFrames = std::min<UInt32>(kRenderBufferSize, numberOfFrames - frameOffset);
+        for (UInt32 i = 0; i < ioData->mNumberBuffers; ++i) {
+            UInt32 bytesPerFrame = buffers[i].mDataByteSize / numberOfFrames;
+            UInt32 byteOffset = frameOffset * bytesPerFrame;
+            float* memory = (float*)((char*)buffers[i].mData + byteOffset);
+            m_renderBus->setChannelMemory(i, memory, remainingFrames);
         }
-
-        UInt32 framesThisTime = std::min<UInt32>(kRenderBufferSize, framesRemaining);
-        assignAudioBuffersToBus(buffers, *m_renderBus, numberOfBuffers, numberOfFrames, frameOffset, framesThisTime);
-
-        if (framesThisTime < kRenderBufferSize) {
-            m_callback.render(0, m_spareBus.get(), kRenderBufferSize);
-            m_renderBus->copyFromRange(*m_spareBus, 0, framesThisTime);
-            m_firstSpareFrame = framesThisTime;
-            m_lastSpareFrame = kRenderBufferSize - 1;
-        } else
-            m_callback.render(0, m_renderBus.get(), framesThisTime);
-        frameOffset += framesThisTime;
-        framesRemaining -= framesThisTime;
+        m_callback.render(0, m_renderBus.get(), remainingFrames);
     }
 
     return noErr;

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.h (198956 => 198957)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.h	2016-04-01 21:40:20 UTC (rev 198956)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.h	2016-04-01 21:44:30 UTC (rev 198957)
@@ -65,9 +65,6 @@
     AudioUnit m_outputUnit;
     AudioIOCallback& m_callback;
     RefPtr<AudioBus> m_renderBus;
-    RefPtr<AudioBus> m_spareBus;
-    unsigned m_firstSpareFrame { 0 };
-    unsigned m_lastSpareFrame { 0 };
 
     double m_sampleRate;
     bool m_isPlaying;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to