]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/alsa.c
Accept MP3 as an alternative to MPGA for RTP and TS.
[vlc] / modules / audio_output / alsa.c
index dbcb02bc1a6b01d71961a844e3222e84d9811216..a9d851de62554e0324f2005836d6086161741db6 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
 #include <errno.h>                                                 /* ENOMEM */
@@ -830,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