Commit c35c18a6 authored by Laurent Aimar's avatar Laurent Aimar

Do not set object b_eof/b_error after sending the event.

This fixes a few "deadlocks" with input waiting for playlist, while
playlist is waiting for input event.
parent 5b638392
......@@ -499,8 +499,6 @@ static void* Run( vlc_object_t *p_this )
if( Init( p_input ) )
{
/* If we failed, wait before we are killed, and exit */
p_input->b_error = true;
WaitDie( p_input );
/* Tell we're dead */
......@@ -526,7 +524,6 @@ static void* Run( vlc_object_t *p_this )
}
/* We have finished */
p_input->b_eof = true;
input_ChangeState( p_input, END_S );
}
......@@ -574,7 +571,7 @@ static void* RunAndDestroy( vlc_object_t *p_this )
}
/* We have finished */
p_input->b_eof = true;
input_ChangeState( p_input, END_S );
}
/* Clean up */
......@@ -689,7 +686,7 @@ static void MainLoop( input_thread_t *p_input )
}
else if( i_ret < 0 )
{
p_input->b_error = true;
input_ChangeState( p_input, ERROR_S );
}
if( i_ret > 0 && p_input->p->i_slave > 0 )
......
......@@ -389,29 +389,33 @@ void input_ClockSetRate( input_clock_t *cl, int i_rate );
char **subtitles_Detect( input_thread_t *, char* path, const char *fname );
int subtitles_Filter( const char *);
static inline void input_ChangeStateWithVarCallback( input_thread_t *p_input, int state, bool callback )
static inline void input_ChangeStateWithVarCallback( input_thread_t *p_input, int i_state, bool callback )
{
const bool changed = p_input->i_state != state;
const bool changed = p_input->i_state != i_state;
p_input->i_state = state;
p_input->i_state = i_state;
if( i_state == ERROR_S )
p_input->b_error = true;
else if( i_state == END_S )
p_input->b_eof = true;
input_item_SetHasErrorWhenReading( p_input->p->input.p_item, (state == ERROR_S) );
input_item_SetHasErrorWhenReading( p_input->p->input.p_item, (i_state == ERROR_S) );
if( callback )
{
var_SetInteger( p_input, "state", state );
var_SetInteger( p_input, "state", i_state );
}
else
{
vlc_value_t val;
val.i_int = state;
val.i_int = i_state;
var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
}
if( changed )
{
vlc_event_t event;
event.type = vlc_InputStateChanged;
event.u.input_state_changed.new_state = state;
event.u.input_state_changed.new_state = i_state;
vlc_event_send( &p_input->p->event_manager, &event );
}
}
......
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