From 3977a906e21fe215051c0a82cf951cc12080fbb1 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Mon, 4 Jan 2016 12:33:11 +0530 Subject: [PATCH] coreaudio: Catch devices with more channels than we support --- src/modules/macosx/module-coreaudio-device.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c index aa299a0a3..6c9e55dd1 100644 --- a/src/modules/macosx/module-coreaudio-device.c +++ b/src/modules/macosx/module-coreaudio-device.c @@ -415,6 +415,11 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx AudioObjectPropertyAddress property_address; CFStringRef tmp_cfstr = NULL; + if (buf->mNumberChannels > PA_CHANNELS_MAX) { + pa_log("Skipping device with more channels than we support (%u)", (unsigned int) buf->mNumberChannels); + return -1; + } + ca_sink = pa_xnew0(coreaudio_sink, 1); ca_sink->map.channels = buf->mNumberChannels; ca_sink->ss.channels = buf->mNumberChannels; @@ -543,6 +548,11 @@ static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_i AudioObjectPropertyAddress property_address; CFStringRef tmp_cfstr = NULL; + if (buf->mNumberChannels > PA_CHANNELS_MAX) { + pa_log("Skipping device with more channels than we support (%u)", (unsigned int) buf->mNumberChannels); + return -1; + } + ca_source = pa_xnew0(coreaudio_source, 1); ca_source->map.channels = buf->mNumberChannels; ca_source->ss.channels = buf->mNumberChannels;