[xiph-cvs] cvs commit: ao/src/plugins/alsa09 ao_alsa09.c

Warren Dukes shank at xiph.org
Sat Oct 11 06:31:22 PDT 2003



shank       03/10/11 09:31:21

  Modified:    src/plugins/alsa09 ao_alsa09.c
  Log:
  Fix for bug #456.
  
  Set threshold to 0, as that seems to be causing dmix to deadlock in poll().

Revision  Changes    Path
1.18      +13 -8     ao/src/plugins/alsa09/ao_alsa09.c

Index: ao_alsa09.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/alsa09/ao_alsa09.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ao_alsa09.c	10 Sep 2003 14:21:15 -0000	1.17
+++ ao_alsa09.c	11 Oct 2003 13:31:20 -0000	1.18
@@ -288,6 +288,17 @@
         if (err < 0)
                 return err;
 
+	/* allow transfers to start when there are four periods */
+	/* setting the threshold to a very big values seems to cause a
+	   deadlock for dmix in a pol().  So here we just set it to 0,
+	   I'm not sure why we need to set a threshold > 0 anyway, maybe 
+	   someone could enlighten me. - shank */
+	internal->cmd = "snd_pcm_sw_params_set_start_threshold";
+	err = snd_pcm_sw_params_set_start_threshold(internal->pcm_handle,
+			params, /*internal->period_size << 2*/0);
+	if (err < 0)
+		return err;
+
         /* require a minimum of one full transfer in the buffer */
         internal->cmd = "snd_pcm_sw_params_set_avail_min";
         err = snd_pcm_sw_params_set_avail_min(internal->pcm_handle, params,
@@ -295,13 +306,6 @@
         if (err < 0)
                 return err;
 
-	/* allow transfers to start when there are four periods */
-	internal->cmd = "snd_pcm_sw_params_set_start_threshold";
-	err = snd_pcm_sw_params_set_start_threshold(internal->pcm_handle,
-			params, internal->period_size << 2);
-	if (err < 0)
-		return err;
-
         /* do not align transfers */
         internal->cmd = "snd_pcm_sw_params_set_xfer_align";
         err = snd_pcm_sw_params_set_xfer_align(internal->pcm_handle, params, 1);
@@ -417,8 +421,9 @@
 #endif
 
                 /* it's possible that no data was transferred */
-		if (err == -EAGAIN)
+		if (err == -EAGAIN) {
                         continue;
+		}
 
                 if (err < 0) {
                         /* this might be an error, or an exception */

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list