From 9085cf18df1a4266eba4ac0669a6b446f810a5f3 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 18 Jan 2022 16:48:37 -0800 Subject: [PATCH] Core Audio output: Fix crash on playback reaching the end of the playlist --- Audio/Output/OutputCoreAudio.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Audio/Output/OutputCoreAudio.m b/Audio/Output/OutputCoreAudio.m index a33e306ee..99f4dddb6 100644 --- a/Audio/Output/OutputCoreAudio.m +++ b/Audio/Output/OutputCoreAudio.m @@ -126,7 +126,7 @@ static OSStatus renderCallback( void *inRefCon, AudioUnitRenderActionFlags *ioAc // Either underrun, or no data at all. Caller output tends to just // buffer loop if it doesn't get anything, so always produce a full // buffer, and silence anything we couldn't supply. - clearBuffers(ioData, amountToRead - amountRead, amountRead / bytesPerPacket); + clearBuffers(ioData, (amountToRead - amountRead) / bytesPerPacket, amountRead / bytesPerPacket); } return 0;