From d9a09bff4081768e60f0dd24f6e1f7545288cde5 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 19 Jul 2022 23:03:00 -0700 Subject: [PATCH] [Audio Output] Eliminated another stack buffer Another large stack buffer was at play here. Consolidated it into an existing buffer that can perform double duty here, since neither place it's used conflicts with each other. Signed-off-by: Christopher Snowhill --- Audio/Output/OutputAVFoundation.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Audio/Output/OutputAVFoundation.m b/Audio/Output/OutputAVFoundation.m index 25e7e22eb..56837b3b9 100644 --- a/Audio/Output/OutputAVFoundation.m +++ b/Audio/Output/OutputAVFoundation.m @@ -139,16 +139,15 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA location:@"pre downmix"]; #endif // It should be fine to request up to double, we'll only get downsampled - float outputBuffer[amountToRead * newFormat.mChannelsPerFrame]; const float *outputPtr = (const float *)[samples bytes]; if(r8bstate) { size_t inDone = 0; [currentPtsLock lock]; - size_t framesDone = r8bstate_resample(r8bstate, outputPtr, frameCount, &inDone, &outputBuffer[0], amountToRead); + size_t framesDone = r8bstate_resample(r8bstate, outputPtr, frameCount, &inDone, &r8bTempBuffer[0], amountToRead); [currentPtsLock unlock]; if(!framesDone) return 0; frameCount = (int)framesDone; - outputPtr = &outputBuffer[0]; + outputPtr = &r8bTempBuffer[0]; chunkDuration = frameCount / newFormat.mSampleRate; }