Commit 18d8fa4a authored by Laurent Aimar's avatar Laurent Aimar
Browse files

Do not vlc_object_kill on vout/aout and sout when stopping input (close #1673).

(The vout should never be killed before the decoder is stopped as we may
use direct buffers).
parent 235529f2
...@@ -298,12 +298,12 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, ...@@ -298,12 +298,12 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
memset( &p_input->p->counters, 0, sizeof( p_input->p->counters ) ); memset( &p_input->p->counters, 0, sizeof( p_input->p->counters ) );
vlc_mutex_init( &p_input->p->counters.counters_lock ); vlc_mutex_init( &p_input->p->counters.counters_lock );
/* Attach only once we are ready */
vlc_object_attach( p_input, p_parent );
/* Set the destructor when we are sure we are initialized */ /* Set the destructor when we are sure we are initialized */
vlc_object_set_destructor( p_input, (vlc_destructor_t)Destructor ); vlc_object_set_destructor( p_input, (vlc_destructor_t)Destructor );
/* Attach only once we are ready */
vlc_object_attach( p_input, p_parent );
return p_input; return p_input;
} }
...@@ -443,15 +443,21 @@ int __input_Preparse( vlc_object_t *p_parent, input_item_t *p_item ) ...@@ -443,15 +443,21 @@ int __input_Preparse( vlc_object_t *p_parent, input_item_t *p_item )
* *
* \param the input thread to stop * \param the input thread to stop
*/ */
static void ObjectKillChildrens( vlc_object_t *p_obj ) static void ObjectKillChildrens( input_thread_t *p_input, vlc_object_t *p_obj )
{ {
vlc_list_t *p_list; vlc_list_t *p_list;
int i; int i;
if( p_obj->i_object_type == VLC_OBJECT_VOUT ||
p_obj->i_object_type == VLC_OBJECT_AOUT ||
p_obj == VLC_OBJECT(p_input->p->p_sout) )
return;
vlc_object_kill( p_obj ); vlc_object_kill( p_obj );
p_list = vlc_list_children( p_obj ); p_list = vlc_list_children( p_obj );
for( i = 0; i < p_list->i_count; i++ ) for( i = 0; i < p_list->i_count; i++ )
ObjectKillChildrens( p_list->p_values[i].p_object ); ObjectKillChildrens( p_input, p_list->p_values[i].p_object );
vlc_list_release( p_list ); vlc_list_release( p_list );
} }
void input_StopThread( input_thread_t *p_input ) void input_StopThread( input_thread_t *p_input )
...@@ -459,7 +465,7 @@ void input_StopThread( input_thread_t *p_input ) ...@@ -459,7 +465,7 @@ void input_StopThread( input_thread_t *p_input )
/* Set die for input and ALL of this childrens (even (grand-)grand-childrens) /* Set die for input and ALL of this childrens (even (grand-)grand-childrens)
* It is needed here even if it is done in INPUT_CONTROL_SET_DIE handler to * It is needed here even if it is done in INPUT_CONTROL_SET_DIE handler to
* unlock the control loop */ * unlock the control loop */
ObjectKillChildrens( VLC_OBJECT(p_input) ); ObjectKillChildrens( p_input, VLC_OBJECT(p_input) );
input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL ); input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL );
} }
...@@ -1436,7 +1442,7 @@ static bool Control( input_thread_t *p_input, int i_type, ...@@ -1436,7 +1442,7 @@ static bool Control( input_thread_t *p_input, int i_type,
msg_Dbg( p_input, "control: stopping input" ); msg_Dbg( p_input, "control: stopping input" );
/* Mark all submodules to die */ /* Mark all submodules to die */
ObjectKillChildrens( p_input ); ObjectKillChildrens( p_input, VLC_OBJECT(p_input) );
break; break;
case INPUT_CONTROL_SET_POSITION: case INPUT_CONTROL_SET_POSITION:
......
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