File libao-alsa-fix.diff of Package libao
Index: src/plugins/alsa/ao_alsa.c
===================================================================
--- src/plugins/alsa/ao_alsa.c.orig
+++ src/plugins/alsa/ao_alsa.c
@@ -265,14 +265,6 @@ static inline int alsa_set_hwparams(ao_d
"by the hardware, using %u\n", format->rate, rate);
}
- /* set the length of the hardware sample buffer in microseconds */
- err = snd_pcm_hw_params_set_buffer_time_near(internal->pcm_handle,
- params, &(internal->buffer_time), 0);
- if (err < 0){
- adebug("snd_pcm_hw_params_set_buffer_time_near() failed.\n");
- return err;
- }
-
/* calculate a period time of one half sample time */
if ((internal->period_time == 0) && (rate > 0))
internal->period_time =
@@ -286,6 +278,14 @@ static inline int alsa_set_hwparams(ao_d
return err;
}
+ /* set the length of the hardware sample buffer in microseconds */
+ err = snd_pcm_hw_params_set_buffer_time_near(internal->pcm_handle,
+ params, &(internal->buffer_time), 0);
+ if (err < 0){
+ adebug("snd_pcm_hw_params_set_buffer_time_near() failed.\n");
+ return err;
+ }
+
/* commit the params structure to the hardware via ALSA */
err = snd_pcm_hw_params(internal->pcm_handle, params);
if (err < 0){