[nas] [PATCH] really allow mixer init to fail

Erik Auerswald auerswal at unix-ag.uni-kl.de
Sun Jul 30 03:28:45 MDT 2006


Hi,

opening the mixer device should be allowed to fail according to
http://radscan.com/nas/nas-ml/msg01121.html. But right now it may only
fail on startup, not when re-opening the audio device. The attached
patch corrects this issue.

Erik
-------------- next part --------------
Index: server/dda/voxware/auvoxware.c
===================================================================
--- server/dda/voxware/auvoxware.c	(revision 173)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -853,10 +853,18 @@
     if (mixerfd == -1) {
         while ((mixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
                                0666)) == -1 && wait) {
-            osLogMsg("openDevice: waiting on mixer device\n");
-            sleep(1);
+            if ((errno == EAGAIN) || (errno == EBUSY)) {
+                osLogMsg("openDevice: waiting on mixer device %s\n",
+                         sndStatOut.mixer);
+                sleep(1);
+            } else {
+                osLogMsg("openDevice: could not open mixer device %s: %s\n",
+                         sndStatOut.mixer, strerror(errno));
+                break;
+            }
         }
-        osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
+        if (mixerfd != -1)
+            osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
     } else {
         if (NasConfig.DoDebug) {
             osLogMsg("openDevice: mixer device already open\n");


More information about the Nas mailing list