[vlc-devel] commit: Join the input thread before we destroy the input object ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Aug 17 12:19:53 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Aug 17 13:21:04 2008 +0300| [4d799ee31ca45d72aa4bab573d3022c36af811be] | committer: Rémi Denis-Courmont
Join the input thread before we destroy the input object
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4d799ee31ca45d72aa4bab573d3022c36af811be
---
src/input/vlm.c | 26 +++++++++++++++-----------
src/playlist/engine.c | 1 +
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/src/input/vlm.c b/src/input/vlm.c
index db53c38..95dca27 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -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 )
{
- if( p_instance->p_input )
+ input_thread_t *p_input = p_instance->p_input;
+ if( p_input )
{
- input_StopThread( p_instance->p_input );
- p_instance->p_sout = input_DetachSout( p_instance->p_input );
- vlc_object_release( p_instance->p_input );
+ input_StopThread( p_input );
+ p_instance->p_sout = input_DetachSout( p_input );
+ vlc_thread_join( p_input );
+ vlc_object_release( p_input );
}
if( 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 *
}
/* 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 &&
- !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 )
- var_SetInteger( p_instance->p_input, "state", PLAYING_S );
+ if( var_GetInteger( p_input, "state" ) == PAUSE_S )
+ var_SetInteger( p_input, "state", PLAYING_S );
return VLC_SUCCESS;
}
- input_StopThread( p_instance->p_input );
- p_instance->p_sout = input_DetachSout( p_instance->p_input );
- vlc_object_release( p_instance->p_input );
+ input_StopThread( p_input );
+ p_instance->p_sout = input_DetachSout( p_input );
+ vlc_thread_join( p_input );
+ vlc_object_release( p_input );
if( !p_instance->b_sout_keep && p_instance->p_sout )
{
sout_DeleteInstance( p_instance->p_sout );
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index c1f3ed2..e0c58dd 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -241,6 +241,7 @@ void playlist_release_current_input( playlist_t * p_playlist )
/* Release the playlist lock, because we may get stuck
* in vlc_object_release() for some time. */
PL_UNLOCK;
+ vlc_thread_join( p_input );
vlc_object_release( p_input );
PL_LOCK;
}
More information about the vlc-devel
mailing list