]> git.sesse.net Git - vlc/commitdiff
forward port [25261]
authorRafaël Carré <funman@videolan.org>
Sun, 24 Feb 2008 10:21:46 +0000 (10:21 +0000)
committerRafaël Carré <funman@videolan.org>
Sun, 24 Feb 2008 10:21:46 +0000 (10:21 +0000)
workaround buggy alsa drivers

modules/audio_output/alsa.c

index 945f276b80a45f17762483a49cd5a7bade6a67ab..a9d851de62554e0324f2005836d6086161741db6 100644 (file)
@@ -834,9 +834,11 @@ static void ALSAFill( aout_instance_t * p_aout )
     }
     else
     {
-        /* Here the device should be in RUNNING state.
-         * p_status is valid. */
+        /* Here the device should be in RUNNING state, p_status is valid. */
         snd_pcm_sframes_t delay = snd_pcm_status_get_delay( p_status );
+        if( delay == 0 ) /* workaround buggy alsa drivers */
+            if( snd_pcm_delay( p_sys->p_snd_pcm, &delay ) < 0 )
+                delay = 0; /* FIXME: use a positive minimal delay */
         int i_bytes = snd_pcm_frames_to_bytes( p_sys->p_snd_pcm, delay );
         next_date = mdate() + ( (mtime_t)i_bytes * 1000000
                 / p_aout->output.output.i_bytes_per_frame