[alsa-devel] Dubious assertion in alsa-lib

Alexander E. Patrakov patrakov at gmail.com
Sun Nov 21 10:39:56 CET 2010


In alsa-lib-1.0.23/src/pcm/pcm_plug.c, there are two assertions of the form:


in snd_pcm_plug_change_rate() and snd_pcm_plug_change_channels() 
functions, respectively. While in snd_pcm_plug_change_rate() this looks 
reasonable, it is IMHO invalid in snd_pcm_plug_change_channels(). I say 
this because this can be triggered with the following .asoundrc:

pcm.jackplug {
	type plug
	slave.pcm {
		type jack
		playback_ports {
			0 system:playback_1
			1 system:playback_2
		capture_ports {
			0 system:capture_1
			1 system:capture_2
		client_name "alsa"

and the following command:

aplay -r 44100 -c 1 -f FLOAT_LE -D jackplug /dev/zero

JACK is configured to accept stereo audio, with 44100 Hz sampling rate, 
so only the number of channels has to be changed by the plug here.

I.e., rerouting channels by copying samples makes perfect sense not only 
for linear formats, but also for floating-point ones.

Alexander E. Patrakov

More information about the Alsa-devel mailing list