[xiph-commits] r16861 - in trunk/ao/src: . plugins/alsa

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Jan 31 03:35:13 PST 2010


Author: xiphmont
Date: 2010-01-31 03:35:13 -0800 (Sun, 31 Jan 2010)
New Revision: 16861

Modified:
   trunk/ao/src/audio_out.c
   trunk/ao/src/plugins/alsa/ao_alsa.c
Log:
Attempted fix for VIA82xx end-of-playback clicks.



Modified: trunk/ao/src/audio_out.c
===================================================================
--- trunk/ao/src/audio_out.c	2010-01-31 10:42:33 UTC (rev 16860)
+++ trunk/ao/src/audio_out.c	2010-01-31 11:35:13 UTC (rev 16861)
@@ -197,7 +197,6 @@
 		while (driver != NULL) {
 
 			info = driver->functions->driver_info();
-
 			if ( info->type == AO_TYPE_LIVE &&
 			     info->priority > 0 && /* Skip static drivers */
 			     driver->functions->test() ) {

Modified: trunk/ao/src/plugins/alsa/ao_alsa.c
===================================================================
--- trunk/ao/src/plugins/alsa/ao_alsa.c	2010-01-31 10:42:33 UTC (rev 16860)
+++ trunk/ao/src/plugins/alsa/ao_alsa.c	2010-01-31 11:35:13 UTC (rev 16861)
@@ -332,12 +332,34 @@
 	if (err < 0)
 		return err;
 
-	/* do not align transfers */
+	/* do not align transfers; this is obsolete/deprecated in ALSA
+           1.x where the transfer alignemnt is always 1 (except for
+           buggy drivers like VIA 82xx which still demand aligned
+           transfers regardless of setting, in violation of the ALSA
+           API docs) */
 	internal->cmd = "snd_pcm_sw_params_set_xfer_align";
 	err = snd_pcm_sw_params_set_xfer_align(internal->pcm_handle, params, 1);
 	if (err < 0)
 		return err;
 
+        /* force a work-ahead silence buffer; this is an attempted
+           fix, again for VIA 82xx, where non-MMIO transfers will
+           buffer into period-size transfers, but the last transfer is
+           usually undersized and playback falls off the end of the
+           submitted data. */
+        {
+          snd_pcm_uframes_t boundary;
+          internal->cmd = "snd_pcm_sw_params_get_boundary";
+          err = snd_pcm_sw_params_get_boundary(params,&boundary);
+          if (err < 0)
+            return err;
+
+          internal->cmd = "snd_pcm_sw_params_set_silence_size";
+          err = snd_pcm_sw_params_set_silence_size(internal->pcm_handle, params, boundary);
+          if (err < 0)
+            return err;
+        }
+
 	/* commit the params structure to ALSA */
 	internal->cmd = "snd_pcm_sw_params";
 	err = snd_pcm_sw_params(internal->pcm_handle, params);



More information about the commits mailing list