Multiple instance patch for ESOUND

Rocky Zhang <[email protected]>
Newsgroups gmane.comp.gnome.multimedia
Message-ID <[email protected]>
Hi everyone,

I found I can't launch esd daemon for multiple instances with default
socket in one computer. Here I connect 2 USB headsets to my computer and
2 different users to use the audio devices at the same time. I looked
into esound source code and found that it is a lock of socket
file /tmp/.esd/socket, and it prevent another user to launch multiple
instances. I slightly modify the source code, different screen # use
different socket directory, like testuser1 working on screen 0
( $DISPLAY = :0.0 ), use /tmp/.esd-0/socket; testuser2 works on screen 1
( $DISPLAY = :1.0 ) and so on; They can launch different esd daemon for
them.

See the patch in the attachment.

I wonder if it is valuable for others and if I can commit to CVS.

Thanks.

XiaoQian (Rocky)  Zhang

_______________________________________________
gnome-multimedia mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-multimedia
esound-multiuser-audio.patch (text/x-patch, 1.4 KB)
--- ./util.c.userful	2005-05-13 10:32:58.000000000 -0600
+++ ./util.c	2005-05-17 09:58:23.000000000 -0600
@@ -25,6 +25,18 @@
 {
 	char *audiodev;
 	static char *dirname = NULL;
+        //zxq add to use different socket dir for different station
+        int i,j;
+        char socket_dirname[16];
+        strcpy(socket_dirname, getenv("DISPLAY"));
+        j = strlen(socket_dirname);
+        for (i=0; i<j; i++)
+            if ( socket_dirname[i] == ':' )
+               socket_dirname[i] = '-';
+            else if ( socket_dirname[i] == '.' )
+               socket_dirname[i] = '\0';
+     
+
 
 	if (dirname == NULL) {
 		if (!(audiodev = getenv("AUDIODEV"))) {
@@ -35,8 +47,10 @@
 				audiodev = newdev++;
 			}
 		}
-		dirname = malloc(strlen(audiodev) + sizeof("/tmp/.esd"));
-		strcpy(dirname, "/tmp/.esd");
+//		dirname = malloc(strlen(audiodev) + sizeof("/tmp/.esd"));
+		dirname = malloc(strlen(audiodev) + sizeof("/tmp/.esd") + sizeof(socket_dirname));
+                strcpy(dirname, "/tmp/.esd");
+		strcat(dirname, socket_dirname);
 		strcat(dirname, audiodev);
 	}
 
--- ./esd.conf.userful	2005-06-24 10:56:40.000000000 -0600
+++ ./esd.conf	2005-06-24 10:57:01.000000000 -0600
@@ -1,6 +1,6 @@
 [esd]
 auto_spawn=1
-spawn_options=-terminate -nobeeps -as 2
+spawn_options=
 spawn_wait_ms=100
 # default options are used in spawned and non-spawned mode
-default_options=
+default_options=-terminate -nobeeps -as 2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.