[xiph-commits] r18774 - in trunk/ao: . doc src/plugins/alsa src/plugins/oss
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Mon Jan 21 02:19:37 PST 2013
Author: xiphmont
Date: 2013-01-21 02:19:37 -0800 (Mon, 21 Jan 2013)
New Revision: 18774
Modified:
trunk/ao/configure.ac
trunk/ao/doc/drivers.html
trunk/ao/src/plugins/alsa/ao_alsa.c
trunk/ao/src/plugins/oss/ao_oss.c
Log:
Add some buffer latency adjustments to OSS driver
add buffer_time option to OSS driver
Modified: trunk/ao/configure.ac
===================================================================
--- trunk/ao/configure.ac 2013-01-16 12:07:15 UTC (rev 18773)
+++ trunk/ao/configure.ac 2013-01-21 10:19:37 UTC (rev 18774)
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([libao],[1.1.0],[monty at xiph.org])
+AC_INIT([libao],[1.2.0],[monty at xiph.org])
AM_INIT_AUTOMAKE([gnu 1.6])
AM_MAINTAINER_MODE
@@ -9,9 +9,9 @@
AM_DISABLE_STATIC
dnl Library versioning
-LIB_CURRENT=4
+LIB_CURRENT=5
LIB_REVISION=0
-LIB_AGE=0
+LIB_AGE=1
AC_SUBST(LIB_CURRENT)
AC_SUBST(LIB_REVISION)
AC_SUBST(LIB_AGE)
Modified: trunk/ao/doc/drivers.html
===================================================================
--- trunk/ao/doc/drivers.html 2013-01-16 12:07:15 UTC (rev 18773)
+++ trunk/ao/doc/drivers.html 2013-01-21 10:19:37 UTC (rev 18774)
@@ -189,7 +189,7 @@
<b>Option keys:</b>
<ul>
<li>"buffer_time" - Set the hardware buffer size to the equivalent of
-value milliseconds.
+value in milliseconds.
</ul>
<p>
@@ -226,6 +226,8 @@
<b>Option keys:</b>
<ul>
+<li>"buffer_time" - Override the default hardware buffer size (in
+milliseconds).
<li>"dev" - (see 'Standard Driver Options' above). By default, the driver tries
"/dev/sound/dsp", followed by "/dev/dsp".
<li>"dsp" - Deprecated synonym for "dev".
Modified: trunk/ao/src/plugins/alsa/ao_alsa.c
===================================================================
--- trunk/ao/src/plugins/alsa/ao_alsa.c 2013-01-16 12:07:15 UTC (rev 18773)
+++ trunk/ao/src/plugins/alsa/ao_alsa.c 2013-01-21 10:19:37 UTC (rev 18774)
@@ -40,8 +40,8 @@
#include <ao/ao.h>
#include <ao/plugin.h>
-/* default 500 millisecond buffer */
-#define AO_ALSA_BUFFER_TIME 100000
+/* default 25 millisecond buffer */
+#define AO_ALSA_BUFFER_TIME 25000
/* the period time is calculated if not given as an option */
#define AO_ALSA_PERIOD_TIME 0
Modified: trunk/ao/src/plugins/oss/ao_oss.c
===================================================================
--- trunk/ao/src/plugins/oss/ao_oss.c 2013-01-16 12:07:15 UTC (rev 18773)
+++ trunk/ao/src/plugins/oss/ao_oss.c 2013-01-21 10:19:37 UTC (rev 18774)
@@ -44,8 +44,10 @@
#include "ao/ao.h"
#include "ao/plugin.h"
+/* default 25 millisecond buffer */
+#define AO_OSS_BUFFER_TIME 25000
-static char *ao_oss_options[] = {"dsp","dev","id","verbose","quiet","matrix","debug"};
+static char *ao_oss_options[] = {"dsp","dev","id","buffer_time","verbose","quiet","matrix","debug"};
static ao_info ao_oss_info =
{
AO_TYPE_LIVE,
@@ -65,6 +67,7 @@
int id;
int fd;
int buf_size;
+ unsigned int buffer_time;
} ao_oss_internal;
@@ -182,6 +185,7 @@
internal->dev = NULL;
internal->id = -1;
+ internal->buffer_time = AO_OSS_BUFFER_TIME;
device->internal = internal;
device->output_matrix_order = AO_OUTPUT_MATRIX_FIXED;
@@ -205,11 +209,22 @@
internal->dev=NULL;
internal->id=atoi(value);
}
+ if (!strcmp(key, "buffer_time"))
+ internal->buffer_time = atoi(value) * 1000;
return 1;
}
+static int ilog(long x){
+ int ret=-1;
+ while(x>0){
+ x>>=1;
+ ret++;
+ }
+ return ret;
+}
+
/*
* open the audio device for writing to
*/
@@ -237,6 +252,20 @@
}
}
+ /* try to lower the DSP delay; this ioctl may fail gracefully */
+ {
+
+ long bytesperframe=(format->bits+7)/8*device->output_channels*format->rate*(internal->buffer_time/1000000.);
+ int fraglog=ilog(bytesperframe);
+ int fragment=0x00040000|fraglog,fragcheck;
+
+ fragcheck=fragment;
+ int ret=ioctl(internal->fd,SNDCTL_DSP_SETFRAGMENT,&fragment);
+ if(ret || fragcheck!=fragment){
+ fprintf(stderr,"Could not set DSP fragment size; continuing.\n");
+ }
+ }
+
/* Now set all of the parameters */
#ifdef SNDCTL_DSP_CHANNELS
More information about the commits
mailing list