[alsa-devel] Cannot combine audio devices with more than 64 channels
Jörg Müller
joerg.mueller7744 at gmail.com
Tue Jan 31 18:18:48 CET 2017
I applied the patch to my system and it fixed the error!
However, I get the following error which seems to be caused by a code
not being able to handle more than 256 channels:
> wfs at wfs16:~$ jackd -R -d alsa -C madifx_record_all -P madifx_playback_all
> jackdmp 1.9.10
> Copyright 2001-2005 Paul Davis and others.
> Copyright 2004-2014 Grame.
> jackdmp comes with ABSOLUTELY NO WARRANTY
> This is free software, and you are welcome to redistribute it
> under certain conditions; see the file COPYING for details
> no message buffer overruns
> no message buffer overruns
> no message buffer overruns
> JACK server starting in realtime mode with priority 10
> self-connect-mode is "Don't restrict self connect requests"
> audio_reservation_init
> Acquire audio card Audio0
> creating alsa driver ... madifx_playback_all|madifx_record_all|1024|2|48000|0|0|nomon|swmeter|-|32bit
> configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
> ALSA: final selected sample format for capture: 32bit float little-endian
> ALSA: use 8 periods for capture
> ALSA: final selected sample format for playback: 32bit float little-endian
> ALSA: use 8 periods for playback
> jackd: ../linux/alsa/JackAlsaDriver.cpp:122: virtual int Jack::JackAlsaDriver::Attach(): Assertion `fCaptureChannels < 256' failed.
> Aborted (core dumped)
What could be the problem here?
2017-01-27 12:08 GMT+01:00 Takashi Iwai <tiwai at suse.de>:
> On Thu, 26 Jan 2017 17:13:50 +0100,
> Clemens Ladisch wrote:
>>
>> Jörg Müller wrote:
>> > I created an .asoundrc with 194 inputs for each card.
>> >
>> > pcm_multi.c:1060: snd_pcm_multi_open: Assertion `!slave_map[sidxs[i]][schannels[i]]' failed.
>> >
>> > To me, this looks like a bug.
>>
>> --8<---------------------------------------------------------------->8--
>> pcm: multi: allocate slave_map dynamically
>>
>> Using a fixed-size buffer for an arbitrarily-sized list is not a good idea.
>>
>> Signed-off-by: Clemens Ladisch <clemens at ladisch.de>
>
> It turned out that we don't need the array at all.
> I'll apply the following cleanup (and fix) patch. My previous one was
> buggy.
>
>
> thanks,
>
> Takashi
>
> -- 8< --
> From: Takashi Iwai <tiwai at suse.de>
> Subject: [PATCH] pcm: multi: Drop the fixed slave_map[] in snd_pcm_multi_open()
>
> slave_map[] in snd_pcm_multi_open() is a fixed size array and
> obviously we have no overflow check, and eventually the program gets
> an error when more than 64 channels are used.
>
> Although we can modify the code to allocate the array dynamically, it
> turned out that we can drop the whole slave_map[] thingy in this
> function when looking at the code closely. In the past, it was used
> to identify the one-to-many mapping. But the check was dropped, and
> now it's nothing more than a sanity check.
>
> Reported-by: Jörg Müller <joerg.mueller7744 at gmail.com>
> Signed-off-by: Takashi Iwai <tiwai at suse.de>
> ---
> src/pcm/pcm_multi.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
> index c4b1fba32cac..9e4be7122c0f 100644
> --- a/src/pcm/pcm_multi.c
> +++ b/src/pcm/pcm_multi.c
> @@ -1015,7 +1015,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
> snd_pcm_multi_t *multi;
> unsigned int i;
> snd_pcm_stream_t stream;
> - char slave_map[64][64] = { { 0 } };
> int err;
>
> assert(pcmp);
> @@ -1059,8 +1058,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
> bind->slave_channel = schannels[i];
> if (sidxs[i] < 0)
> continue;
> - assert(!slave_map[sidxs[i]][schannels[i]]);
> - slave_map[sidxs[i]][schannels[i]] = 1;
> }
> multi->channels_count = channels_count;
>
> --
> 2.11.0
>
More information about the Alsa-devel
mailing list