[xiph-cvs] r6751 - in trunk/ao/src/plugins: esd oss

shank at xiph.org shank at xiph.org
Mon May 24 18:59:24 PDT 2004



Author: shank
Date: 2004-05-24 21:59:24 -0400 (Mon, 24 May 2004)
New Revision: 6751

Modified:
   trunk/ao/src/plugins/esd/ao_esd.c
   trunk/ao/src/plugins/oss/ao_oss.c
Log:
use esd_close instead of close when disconnecting from the esd server
for setting rate in OSS plugin, bump sample rate tolerance from 1% to 2% 
(nForce2 uses a sample rate of 48813)

<p>Modified: trunk/ao/src/plugins/esd/ao_esd.c
===================================================================
--- trunk/ao/src/plugins/esd/ao_esd.c	2004-05-24 10:56:26 UTC (rev 6750)
+++ trunk/ao/src/plugins/esd/ao_esd.c	2004-05-25 01:59:24 UTC (rev 6751)
@@ -102,7 +102,7 @@
         ao_esd_internal *internal = (ao_esd_internal *) device->internal;
 
         if (!strcmp(key, "host")) {
-		free(internal->host);
+		if(internal->host) free(internal->host);
                 internal->host = strdup(value);
         }
 
@@ -165,7 +165,7 @@
 {
         ao_esd_internal *internal = (ao_esd_internal *) device->internal;
 
-	close(internal->sock);
+	esd_close(internal->sock);
 
         return 1;
 }
@@ -175,6 +175,6 @@
 {
         ao_esd_internal *internal = (ao_esd_internal *) device->internal;
 
-	free(internal->host);
+	if(internal->host) free(internal->host);
         free(internal);
 }

Modified: trunk/ao/src/plugins/oss/ao_oss.c
===================================================================
--- trunk/ao/src/plugins/oss/ao_oss.c	2004-05-24 10:56:26 UTC (rev 6750)
+++ trunk/ao/src/plugins/oss/ao_oss.c	2004-05-25 01:59:24 UTC (rev 6751)
@@ -231,7 +231,8 @@
                 goto ERR;
         }
         
-	if (ioctl(internal->fd,SNDCTL_DSP_STEREO,&tmp) < 0) {
+	if (ioctl(internal->fd,SNDCTL_DSP_STEREO,&tmp) < 0 || 
+			tmp+1 != format->channels) {
                 fprintf(stderr, "libao - OSS cannot set channels to %d\n", 
                         format->channels);
                 goto ERR;
@@ -263,7 +264,7 @@
            exact data rate, but something close.  Fail only if completely out
            of whack. */
         if (ioctl(internal->fd,SNDCTL_DSP_SPEED, &tmp) < 0
-	    || tmp > 1.01 * format->rate || tmp < 0.99 * format->rate) {
+	    || tmp > 1.02 * format->rate || tmp < 0.98 * format->rate) {
                 fprintf(stderr, "libao - OSS cannot set rate to %d\n", 
                         format->rate);
                 goto ERR;

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list