[Core Audio Output] Guard against nil pointer

Guard against nil refcon in the renderCallback function.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-21 09:37:29 -07:00
parent bacbf52e2d
commit 5d3077963a
1 changed files with 2 additions and 0 deletions

View File

@ -53,6 +53,8 @@ static void scaleBuffersByVolume(AudioBufferList *ioData, float volume) {
static OSStatus renderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) {
@autoreleasepool {
if(!inRefCon) return 0;
OutputCoreAudio *_self = (__bridge OutputCoreAudio *)inRefCon;
const int channels = _self->deviceFormat.mChannelsPerFrame;