Commit 3c5efb42 authored by gbazin's avatar gbazin
Browse files

* src/audio_output/input.c, mixer.c: don't try to resample when the audio...

* src/audio_output/input.c, mixer.c: don't try to resample when the audio output is drifting too much.
parent 8628d18b
......@@ -409,6 +409,36 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
return 0;
}
/* If the audio drift is too big then it's not worth trying to resample
* the audio. */
if ( start_date != 0 &&
( start_date < p_buffer->start_date - 3 * AOUT_PTS_TOLERANCE ) )
{
msg_Warn( p_aout, "audio drift is too big ("I64Fd"), clearing out",
start_date - p_buffer->start_date );
vlc_mutex_lock( &p_aout->input_fifos_lock );
aout_FifoSet( p_aout, &p_input->fifo, 0 );
p_input->p_first_byte_to_mix = NULL;
vlc_mutex_unlock( &p_aout->input_fifos_lock );
if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
msg_Warn( p_aout, "timing screwed, stopping resampling" );
p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
if ( p_input->i_nb_resamplers != 0 )
{
p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
p_input->pp_resamplers[0]->b_continuity = VLC_FALSE;
}
start_date = 0;
}
else if ( start_date != 0 &&
( start_date > p_buffer->start_date + 3 * AOUT_PTS_TOLERANCE ) )
{
msg_Warn( p_aout, "audio drift is too big ("I64Fd"), dropping buffer",
start_date - p_buffer->start_date );
aout_BufferFree( p_buffer );
return 0;
}
if ( start_date == 0 ) start_date = p_buffer->start_date;
/* Run pre-filters. */
......
......@@ -274,8 +274,13 @@ static int MixBuffer( aout_instance_t * p_aout )
/* Round to the nearest multiple */
i_nb_bytes /= p_aout->mixer.mixer.i_bytes_per_frame;
i_nb_bytes *= p_aout->mixer.mixer.i_bytes_per_frame;
if( i_nb_bytes < 0 ) break; /* FIXME: reset state properly */
if( i_nb_bytes < 0 )
{
/* Is it really the best way to do it ? */
aout_FifoSet( p_aout, &p_aout->output.fifo, 0 );
aout_DateSet( &exact_start_date, 0 );
break;
}
p_input->p_first_byte_to_mix = p_buffer->p_buffer + i_nb_bytes;
}
......
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