coreaudio: Catch devices with more channels than we support

This commit is contained in:
Arun Raghavan 2016-01-04 12:33:11 +05:30
parent cf503f9560
commit 3977a906e2

View file

@ -415,6 +415,11 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx
AudioObjectPropertyAddress property_address; AudioObjectPropertyAddress property_address;
CFStringRef tmp_cfstr = NULL; 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 = pa_xnew0(coreaudio_sink, 1);
ca_sink->map.channels = buf->mNumberChannels; ca_sink->map.channels = buf->mNumberChannels;
ca_sink->ss.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; AudioObjectPropertyAddress property_address;
CFStringRef tmp_cfstr = NULL; 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 = pa_xnew0(coreaudio_source, 1);
ca_source->map.channels = buf->mNumberChannels; ca_source->map.channels = buf->mNumberChannels;
ca_source->ss.channels = buf->mNumberChannels; ca_source->ss.channels = buf->mNumberChannels;