Commit c470bfae authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: fix signaling dead input

This ensures that the dead event input is not missed. The condition
variable was not used properly.
parent 06ce5bd0
......@@ -251,6 +251,7 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
pl_priv(p_playlist)->status.p_item = NULL;
pl_priv(p_playlist)->status.p_node = p_playlist->p_playing;
pl_priv(p_playlist)->request.b_request = false;
p->request.input_dead = false;
if (ml != NULL)
playlist_MLLoad( p_playlist );
......
......@@ -76,6 +76,7 @@ typedef struct playlist_private_t
bool b_request;/**< Set to true by the requester
The playlist sets it back to false
when processing the request */
bool input_dead; /**< Set when input has finished. */
} request;
vlc_thread_t thread; /**< engine thread */
......
......@@ -99,9 +99,11 @@ static int InputEvent( vlc_object_t *p_this, char const *psz_cmd,
if( newval.i_int == INPUT_EVENT_DEAD )
{
playlist_private_t *sys = pl_priv(p_playlist);
PL_LOCK;
/* XXX: signaling while not changing any parameter... suspicious... */
vlc_cond_signal( &pl_priv(p_playlist)->signal );
sys->request.input_dead = true;
vlc_cond_signal( &sys->signal );
PL_UNLOCK;
}
return VLC_SUCCESS;
......@@ -430,12 +432,10 @@ static void LoopInput( playlist_t *p_playlist )
input_Stop( p_input );
}
switch( var_GetInteger( p_input, "state" ) )
{
case END_S:
case ERROR_S:
/* This input is dead. Remove it ! */
if( p_sys->request.input_dead )
{ /* This input is dead. Remove it ! */
p_sys->p_input = NULL;
p_sys->request.input_dead = false;
PL_DEBUG( "dead input" );
PL_UNLOCK;
......@@ -449,10 +449,9 @@ static void LoopInput( playlist_t *p_playlist )
input_Close( p_input );
PL_LOCK;
break;
default:
vlc_cond_wait( &p_sys->signal, &p_sys->lock );
}
else
vlc_cond_wait( &p_sys->signal, &p_sys->lock );
}
static bool Next( playlist_t *p_playlist )
......
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