Commit 9fcd7b2f authored by Laurent Aimar's avatar Laurent Aimar

Fixed invalid locking order when activating visualization.

parent 27a5042b
...@@ -108,6 +108,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_ ...@@ -108,6 +108,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input ); int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input );
int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input, int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer, int i_input_rate ); aout_buffer_t * p_buffer, int i_input_rate );
void aout_InputCheckAndRestart( aout_instance_t * p_aout, aout_input_t * p_input );
/* From filters.c : */ /* From filters.c : */
int aout_FiltersCreatePipeline ( aout_instance_t * p_aout, filter_t ** pp_filters, int * pi_nb_filters, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format ); int aout_FiltersCreatePipeline ( aout_instance_t * p_aout, filter_t ** pp_filters, int * pi_nb_filters, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format );
......
...@@ -305,11 +305,14 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -305,11 +305,14 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
p_buffer->i_length = (mtime_t)p_buffer->i_nb_samples * 1000000 p_buffer->i_length = (mtime_t)p_buffer->i_nb_samples * 1000000
/ p_input->input.i_rate; / p_input->input.i_rate;
aout_lock_mixer( p_aout );
aout_lock_input( p_aout, p_input ); aout_lock_input( p_aout, p_input );
if( p_input->b_error ) if( p_input->b_error )
{ {
aout_unlock_input( p_aout, p_input ); aout_unlock_input( p_aout, p_input );
aout_unlock_mixer( p_aout );
aout_BufferFree( p_buffer ); aout_BufferFree( p_buffer );
return -1; return -1;
} }
...@@ -333,6 +336,9 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input, ...@@ -333,6 +336,9 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
p_input->b_changed = false; p_input->b_changed = false;
} }
aout_InputCheckAndRestart( p_aout, p_input );
aout_unlock_mixer( p_aout );
int i_ret = aout_InputPlay( p_aout, p_input, p_buffer, i_input_rate ); int i_ret = aout_InputPlay( p_aout, p_input, p_buffer, i_input_rate );
aout_unlock_input( p_aout, p_input ); aout_unlock_input( p_aout, p_input );
......
...@@ -456,7 +456,6 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_ ...@@ -456,7 +456,6 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
/* Success */ /* Success */
p_input->b_error = false; p_input->b_error = false;
p_input->b_restart = false;
p_input->i_last_input_rate = INPUT_RATE_DEFAULT; p_input->i_last_input_rate = INPUT_RATE_DEFAULT;
return 0; return 0;
...@@ -493,48 +492,53 @@ int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -493,48 +492,53 @@ int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input )
} }
/***************************************************************************** /*****************************************************************************
* aout_InputPlay : play a buffer * aout_InputCheckAndRestart : restart an input
***************************************************************************** *****************************************************************************
* This function must be entered with the input lock. * This function must be entered with the input and mixer lock.
*****************************************************************************/ *****************************************************************************/
/* XXX Do not activate it !! */ void aout_InputCheckAndRestart( aout_instance_t * p_aout, aout_input_t * p_input )
//#define AOUT_PROCESS_BEFORE_CHEKS
int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer, int i_input_rate )
{ {
mtime_t start_date; AOUT_ASSERT_MIXER_LOCKED;
AOUT_ASSERT_INPUT_LOCKED; AOUT_ASSERT_INPUT_LOCKED;
if( p_input->b_restart ) if( !p_input->b_restart )
{ return;
aout_fifo_t fifo;
uint8_t *p_first_byte_to_mix;
bool b_paused;
mtime_t i_pause_date;
aout_lock_mixer( p_aout ); aout_lock_input_fifos( p_aout );
aout_lock_input_fifos( p_aout );
/* A little trick to avoid loosing our input fifo and properties */ /* A little trick to avoid loosing our input fifo and properties */
p_first_byte_to_mix = p_input->mixer.begin; uint8_t *p_first_byte_to_mix = p_input->mixer.begin;
fifo = p_input->mixer.fifo; aout_fifo_t fifo = p_input->mixer.fifo;
b_paused = p_input->b_paused; bool b_paused = p_input->b_paused;
i_pause_date = p_input->i_pause_date; mtime_t i_pause_date = p_input->i_pause_date;
aout_FifoInit( p_aout, &p_input->mixer.fifo, p_aout->mixer_format.i_rate ); aout_FifoInit( p_aout, &p_input->mixer.fifo, p_aout->mixer_format.i_rate );
aout_InputDelete( p_aout, p_input ); aout_InputDelete( p_aout, p_input );
aout_InputNew( p_aout, p_input, &p_input->request_vout ); aout_InputNew( p_aout, p_input, &p_input->request_vout );
p_input->mixer.begin = p_first_byte_to_mix; p_input->mixer.begin = p_first_byte_to_mix;
p_input->mixer.fifo = fifo; p_input->mixer.fifo = fifo;
p_input->b_paused = b_paused; p_input->b_paused = b_paused;
p_input->i_pause_date = i_pause_date; p_input->i_pause_date = i_pause_date;
aout_unlock_input_fifos( p_aout ); p_input->b_restart = false;
aout_unlock_mixer( p_aout );
} aout_unlock_input_fifos( p_aout );
}
/*****************************************************************************
* aout_InputPlay : play a buffer
*****************************************************************************
* This function must be entered with the input lock.
*****************************************************************************/
/* XXX Do not activate it !! */
//#define AOUT_PROCESS_BEFORE_CHEKS
int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
aout_buffer_t * p_buffer, int i_input_rate )
{
mtime_t start_date;
AOUT_ASSERT_INPUT_LOCKED;
if( i_input_rate != INPUT_RATE_DEFAULT && p_input->p_playback_rate_filter == NULL ) if( i_input_rate != INPUT_RATE_DEFAULT && p_input->p_playback_rate_filter == 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