make JACK client name unique
PATCH 1/1 make JACK client name unique
Now that dmix is working well, I felt like trying something new. :)
This patch changes the JACK plugin to use a unique client name, which allows for multiple ALSA streams to share a JACK server.
Unfortunately, as reported earlier, some apps hang with the JACK plugin, and some even fail, e.g.
ogg123: pcm_plug.c:884: snd_pcm_plug_hw_params: Assertion `err >= 0' failed.
I can provide output from pcm_params.c built with RULES_DEBUG defined if that's useful.
Signature · 2 lines
Earthling Michel Dänzer | Debian (powerpc), X and DRI developer Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer
Index: src/pcm/ext/pcm_jack.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/ext/pcm_jack.c,v retrieving revision 1.4
pcm/ext/pcm_jack.c +11 -2
@@ -697,6 +697,8 @@ int snd_pcm_jack_open(snd_pcm_t **pcmp,snd_pcm_jack_t *jack;int err;int fd[2 ]; +static unsigned int num =0 ; +char jack_client_name[32 ];assert (pcmp);#ifdef PCM_JACK_DEBUG
@@ -723,17 +725,24 @@ int snd_pcm_jack_open(snd_pcm_t **pcmp,if (stream ==SND_PCM_STREAM_PLAYBACK ) { jack->channels = jack->playback_ports_n; - jack->client =jack_client_new ("alsaP" ); }else { jack->channels = jack->capture_ports_n; - jack->client =jack_client_new ("alsaC" ); }if (jack->channels ==0 ) {SNDERR ("define the %s_ports section\n" , stream ==SND_PCM_STREAM_PLAYBACK ?"playback" :"capture" ); goto _free; } + +if (snprintf (jack_client_name,sizeof (jack_client_name),"alsa%s.%d.%d" , + stream ==SND_PCM_STREAM_PLAYBACK ?"P" :"C" ,getpid (), num++) + >=sizeof (jack_client_name)) { +fprintf (stderr,"%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n" , + __func__, jack_client_name,strlen (jack_client_name)); + } + + jack->client =jack_client_new (jack_client_name);if (jack->client==0 ) { err = -ENOENT ;
At Wed, 04 Feb 2004 22:17:19 +0100,
Quoted 7 lines · Michel Dänzer
[1 <text/plain; UTF-8 (8bit)>]
Now that dmix is working well, I felt like trying something new. :)
This patch changes the JACK plugin to use a unique client name, which allows for multiple ALSA streams to share a JACK server.
thanks, committed to cvs now (with compile warning fixes - you shouldn't compare the int return value with sizeof()).
Takashi
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Quoted 8 lines · Takashi Iwai
At Wed, 04 Feb 2004 22:17:19 +0100,
Quoted 3 lines · Michel Dänzer
This patch changes the JACK plugin to use a unique client name, which allows for multiple ALSA streams to share a JACK server.
thanks, committed to cvs now (with compile warning fixes - you shouldn't compare the int return value with
sizeof()).
Whoops, thank you.
Signature · 10 lines
Earthling Michel Dänzer | Debian (powerpc), X and DRI developer Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn