[vlc-commits] aout: clear out input and output FIFO simultaneously

Rémi Denis-Courmont git at videolan.org
Sat Jul 30 22:17:01 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jul 30 23:09:20 2011 +0300| [3d82b2a538604a7591120ea35e3f03a759ef9e1d] | committer: Rémi Denis-Courmont

aout: clear out input and output FIFO simultaneously

This occurs when the output is really late (typically as a side effect
of glitches in pause/resume). Both FIFOs  are now both protected with
the same lock, so there is no room for race conditon between the two
identical checks anymore. So we can handle both checks in one go.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d82b2a538604a7591120ea35e3f03a759ef9e1d
---

 src/audio_output/input.c |    1 +
 src/audio_output/mixer.c |   13 -------------
 2 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/src/audio_output/input.c b/src/audio_output/input.c
index 18e0d92..5dab19a 100644
--- a/src/audio_output/input.c
+++ b/src/audio_output/input.c
@@ -550,6 +550,7 @@ void aout_InputPlay( audio_output_t * p_aout, aout_input_t * p_input,
         msg_Warn( p_aout, "computed PTS is out of range (%"PRId64"), "
                   "clearing out", now - start_date );
         aout_FifoSet( &p_input->fifo, 0 );
+        aout_FifoSet( &p_aout->fifo, 0 );
         if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
             msg_Warn( p_aout, "timing screwed, stopping resampling" );
         inputResamplingStop( p_input );
diff --git a/src/audio_output/mixer.c b/src/audio_output/mixer.c
index 53d001f..fdefdb6 100644
--- a/src/audio_output/mixer.c
+++ b/src/audio_output/mixer.c
@@ -94,7 +94,6 @@ static int MixBuffer( audio_output_t * p_aout, float volume )
 {
     aout_mixer_t *p_mixer = p_aout->p_mixer;
     aout_fifo_t *p_fifo = p_mixer->fifo;
-    mtime_t now = mdate();
     const unsigned samples = p_aout->i_nb_samples;
     /* FIXME: Remove this silly constraint. Just pass buffers as they come to
      * "smart" audio outputs. */
@@ -106,18 +105,6 @@ static int MixBuffer( audio_output_t * p_aout, float volume )
     date_t exact_start_date = p_aout->fifo.end_date;
     mtime_t start_date = date_Get( &exact_start_date );
 
-    if( start_date != 0 && start_date < now )
-    {
-        /* The output is _very_ late. This can only happen if the user
-         * pauses the stream (or if the decoder is buggy, which cannot
-         * happen :). */
-        msg_Warn( p_mixer, "output PTS is out of range (%"PRId64"), clearing out",
-                  mdate() - start_date );
-        aout_FifoSet( &p_aout->fifo, 0 );
-        date_Set( &exact_start_date, 0 );
-        start_date = 0;
-    }
-
     /* See if we have enough data to prepare a new buffer for the audio output. */
     aout_buffer_t *p_buffer = p_fifo->p_first;
     if( p_buffer == NULL )



More information about the vlc-commits mailing list