]> git.sesse.net Git - vlc/commitdiff
alsa: don't start playing before at least a period has been written to the alsa device
authorRafaël Carré <funman@videolan.org>
Sun, 2 Sep 2007 04:03:11 +0000 (04:03 +0000)
committerRafaël Carré <funman@videolan.org>
Sun, 2 Sep 2007 04:03:11 +0000 (04:03 +0000)
fixes #1165

modules/audio_output/alsa.c

index 69f70877925c770a2b03f83de7b9130c913937dd..c13cb36d1f3e9a9c34606fc193eaf75141f35954 100644 (file)
@@ -653,6 +653,15 @@ static int Open( vlc_object_t *p_this )
 
     i_snd_rc = snd_pcm_sw_params_set_avail_min( p_sys->p_snd_pcm, p_sw,
                                                 p_aout->output.i_nb_samples );
+    /* start playing when one period has been written */
+    i_snd_rc = snd_pcm_sw_params_set_start_threshold( p_sys->p_snd_pcm, p_sw,
+                                                      ALSA_DEFAULT_PERIOD_SIZE);
+    if( i_snd_rc < 0 )
+    {
+        msg_Err( p_aout, "unable to set start threshold (%s)",
+                          snd_strerror( i_snd_rc ) );
+        goto error;
+    }
 
     /* Commit software parameters. */
     if ( snd_pcm_sw_params( p_sys->p_snd_pcm, p_sw ) < 0 )