Commit 3d82b2a5 authored by Rémi Denis-Courmont's avatar 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.
parent d6a91eec
......@@ -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 );
......
......@@ -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 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment