changeset 17849:ebebe97331af

To avoid a bug in ALSA's rate plugin that causes spurious overruns, try to disable it so that mplayer's resampler is used.
author cladisch
date Mon, 13 Mar 2006 10:50:37 +0000
parents 4e32c2caf696
children 22d9d212c20e
files libao2/ao_alsa.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Mon Mar 13 10:49:12 2006 +0000
+++ b/libao2/ao_alsa.c	Mon Mar 13 10:50:37 2006 +0000
@@ -533,6 +533,18 @@
 	  return(0);
 	}
 
+      /* workaround for buggy rate plugin (should be fixed in ALSA 1.0.11)
+         prefer our own resampler */
+#if SND_LIB_VERSION >= 0x010009
+      if ((err = snd_pcm_hw_params_set_rate_resample(alsa_handler, alsa_hwparams,
+						     0)) < 0)
+	{
+	  mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to disable resampling: %s\n",
+		 snd_strerror(err));
+	  return(0);
+	}
+#endif
+
       if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams, 
 						 &ao_data.samplerate, NULL)) < 0) 
         {