File libao-alsa-fix.diff of Package libao

--- src/plugins/alsa09/ao_alsa09.c-dist	2007-08-02 12:14:36.000000000 +0200
+++ src/plugins/alsa09/ao_alsa09.c	2007-08-02 12:15:39.000000000 +0200
@@ -260,13 +260,6 @@ static inline int alsa_set_hwparams(ao_a
 			"by the hardware, using %u\n", format->rate, rate);
 	}
 
-	/* set the length of the hardware sample buffer in microseconds */
-	internal->cmd = "snd_pcm_hw_params_set_buffer_time_near";
-	err = snd_pcm_hw_params_set_buffer_time_near(internal->pcm_handle,
-			params, &(internal->buffer_time), 0);
-	if (err < 0)
-		return err;
-
 	/* calculate a period time of one half sample time */
 	if ((internal->period_time == 0) && (rate > 0))
 		internal->period_time =
@@ -279,6 +272,13 @@ static inline int alsa_set_hwparams(ao_a
 	if (err < 0)
 		return err;
 
+	/* set the length of the hardware sample buffer in microseconds */
+	internal->cmd = "snd_pcm_hw_params_set_buffer_time_near";
+	err = snd_pcm_hw_params_set_buffer_time_near(internal->pcm_handle,
+			params, &(internal->buffer_time), 0);
+	if (err < 0)
+		return err;
+
 	/* commit the params structure to the hardware via ALSA */
 	internal->cmd = "snd_pcm_hw_params";
 	err = snd_pcm_hw_params(internal->pcm_handle, params);
openSUSE Build Service is sponsored by