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

Join the input thread before we destroy the input object

parent c8ef90d5
...@@ -759,11 +759,13 @@ static vlm_media_instance_sys_t *vlm_MediaInstanceNew( vlm_t *p_vlm, const char ...@@ -759,11 +759,13 @@ static vlm_media_instance_sys_t *vlm_MediaInstanceNew( vlm_t *p_vlm, const char
} }
static void vlm_MediaInstanceDelete( vlm_media_instance_sys_t *p_instance ) static void vlm_MediaInstanceDelete( vlm_media_instance_sys_t *p_instance )
{ {
if( p_instance->p_input ) input_thread_t *p_input = p_instance->p_input;
if( p_input )
{ {
input_StopThread( p_instance->p_input ); input_StopThread( p_input );
p_instance->p_sout = input_DetachSout( p_instance->p_input ); p_instance->p_sout = input_DetachSout( p_input );
vlc_object_release( p_instance->p_input ); vlc_thread_join( p_input );
vlc_object_release( p_input );
} }
if( p_instance->p_sout ) if( p_instance->p_sout )
sout_DeleteInstance( p_instance->p_sout ); sout_DeleteInstance( p_instance->p_sout );
...@@ -827,19 +829,21 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char * ...@@ -827,19 +829,21 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
} }
/* Stop old instance */ /* Stop old instance */
if( p_instance->p_input ) input_thread_t *p_input = p_instance->p_input;
if( p_input )
{ {
if( p_instance->i_index == i_input_index && if( p_instance->i_index == i_input_index &&
!p_instance->p_input->b_eof && !p_instance->p_input->b_error ) !p_input->b_eof && !p_input->b_error )
{ {
if( var_GetInteger( p_instance->p_input, "state" ) == PAUSE_S ) if( var_GetInteger( p_input, "state" ) == PAUSE_S )
var_SetInteger( p_instance->p_input, "state", PLAYING_S ); var_SetInteger( p_input, "state", PLAYING_S );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
input_StopThread( p_instance->p_input ); input_StopThread( p_input );
p_instance->p_sout = input_DetachSout( p_instance->p_input ); p_instance->p_sout = input_DetachSout( p_input );
vlc_object_release( p_instance->p_input ); vlc_thread_join( p_input );
vlc_object_release( p_input );
if( !p_instance->b_sout_keep && p_instance->p_sout ) if( !p_instance->b_sout_keep && p_instance->p_sout )
{ {
sout_DeleteInstance( p_instance->p_sout ); sout_DeleteInstance( p_instance->p_sout );
......
...@@ -241,6 +241,7 @@ void playlist_release_current_input( playlist_t * p_playlist ) ...@@ -241,6 +241,7 @@ void playlist_release_current_input( playlist_t * p_playlist )
/* Release the playlist lock, because we may get stuck /* Release the playlist lock, because we may get stuck
* in vlc_object_release() for some time. */ * in vlc_object_release() for some time. */
PL_UNLOCK; PL_UNLOCK;
vlc_thread_join( p_input );
vlc_object_release( p_input ); vlc_object_release( p_input );
PL_LOCK; PL_LOCK;
} }
......
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