[pulseaudio-discuss] [PATCH 3/3] coreaudio: Catch devices with more channels than we support
arun at accosted.net
arun at accosted.net
Sun Jan 3 23:15:06 PST 2016
From: Arun Raghavan <git at arunraghavan.net>
---
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 78edc6b..f79924b 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;
--
2.5.0
More information about the pulseaudio-discuss
mailing list