[vlc-devel] [PATCH] audio output and b_can_sleek

Arnaud de Bossoreille de Ribou bozo at via.ecp.fr
Mon Jan 10 15:21:05 CET 2005


Hi,

I have too patch suggestions. One of them may be applied or both.

The problem is that the ALSA audio output does not skip the buffers
that will be too late. It's not really a problem for PCM data since
there is the magic resampler whereas it is for SPDIF data. The first
patch fixes the ALSA audio output, the second one fixes the core audio
output. I didn't try both together. I also didn't check the OSS audio
output.

Regards,

-- 
Arnaud
-------------- next part --------------
--- modules/audio_output/alsa.c	2004-11-06 17:35:06.000000000 +0100
+++ modules/audio_output/alsa.c	2005-01-10 15:01:44.000000000 +0100
@@ -785,6 +785,15 @@
                         (p_aout->output.output.i_format ==
                          VLC_FOURCC('s','p','d','i')) );
 
+        while ( p_buffer && (p_buffer->start_date + AOUT_PTS_TOLERANCE <
+                                next_date))
+        {
+            msg_Dbg( p_aout, "hardware is too slow" );
+            aout_BufferFree( p_buffer );
+            p_buffer = aout_OutputNextBuffer( p_aout, next_date,
+                            (p_aout->output.output.i_format ==
+                             VLC_FOURCC('s','p','d','i')) );
+        }
         /* Audio output buffer shortage -> stop the fill process and wait */
         if( p_buffer == NULL )
         {
-------------- next part --------------
--- src/audio_output/output.c	2004-11-06 17:34:07.000000000 +0100
+++ src/audio_output/output.c	2005-01-10 15:06:44.000000000 +0100
@@ -275,7 +275,8 @@
     vlc_mutex_lock( &p_aout->output_fifo_lock );
 
     p_buffer = p_aout->output.fifo.p_first;
-    while ( p_buffer && p_buffer->start_date < mdate() - AOUT_PTS_TOLERANCE )
+    while ( p_buffer && p_buffer->start_date <
+                    (b_can_sleek ? start_date : mdate()) - AOUT_PTS_TOLERANCE )
     {
         msg_Dbg( p_aout, "audio output is too slow ("I64Fd"), "
                  "trashing "I64Fd"us", mdate() - p_buffer->start_date,


More information about the vlc-devel mailing list