* [PATCH] make JACK client name unique
@ 2004-02-04 21:17 Michel Dänzer
2004-02-05 11:52 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Michel Dänzer @ 2004-02-04 21:17 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 616 bytes --]
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.
--
Earthling Michel Dänzer | Debian (powerpc), X and DRI developer
Libre software enthusiast | http://svcs.affero.net/rm.php?r=daenzer
[-- Attachment #2: alsa-pcm-jack-unique-client-name.diff --]
[-- Type: text/x-patch, Size: 1440 bytes --]
Index: src/pcm/ext/pcm_jack.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/ext/pcm_jack.c,v
retrieving revision 1.4
diff -p -u -r1.4 pcm_jack.c
--- src/pcm/ext/pcm_jack.c 28 Oct 2003 18:19:09 -0000 1.4
+++ src/pcm/ext/pcm_jack.c 4 Feb 2004 19:18:07 -0000
@@ -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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] make JACK client name unique
2004-02-04 21:17 [PATCH] make JACK client name unique Michel Dänzer
@ 2004-02-05 11:52 ` Takashi Iwai
2004-02-05 23:22 ` Michel Dänzer
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2004-02-05 11:52 UTC (permalink / raw)
To: Michel Dänzer; +Cc: alsa-devel
At Wed, 04 Feb 2004 22:17:19 +0100,
Michel Dänzer wrote:
>
> [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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] make JACK client name unique
2004-02-05 11:52 ` Takashi Iwai
@ 2004-02-05 23:22 ` Michel Dänzer
0 siblings, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2004-02-05 23:22 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
On Thu, 2004-02-05 at 12:52, Takashi Iwai wrote:
> At Wed, 04 Feb 2004 22:17:19 +0100,
> Michel Dänzer wrote:
> >
> > 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.
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-02-05 23:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-04 21:17 [PATCH] make JACK client name unique Michel Dänzer
2004-02-05 11:52 ` Takashi Iwai
2004-02-05 23:22 ` Michel Dänzer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.