Commit 1aa4230a authored by Antoine Cellerier's avatar Antoine Cellerier

Fix refcount issues and only vlc_object_find when needed

parent 6a630a52
...@@ -780,12 +780,20 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -780,12 +780,20 @@ static void RunThread( vout_thread_t *p_vout)
display_date = 0; display_date = 0;
current_date = mdate(); current_date = mdate();
if( p_input && p_input->b_die )
{
vlc_object_release( p_input );
p_input = NULL; p_input = NULL;
}
i_loops++; i_loops++;
if( i_loops % 20 == 0 ) if( i_loops % 20 == 0 )
{ {
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT ); if( !p_input )
{
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT,
FIND_PARENT );
}
if( p_input ) if( p_input )
{ {
vlc_mutex_lock( &p_input->counters.counters_lock ); vlc_mutex_lock( &p_input->counters.counters_lock );
...@@ -796,7 +804,6 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -796,7 +804,6 @@ static void RunThread( vout_thread_t *p_vout)
i_displayed , NULL); i_displayed , NULL);
i_displayed = i_lost = 0; i_displayed = i_lost = 0;
vlc_mutex_unlock( &p_input->counters.counters_lock ); vlc_mutex_unlock( &p_input->counters.counters_lock );
vlc_object_release( p_input );
} }
} }
#if 0 #if 0
...@@ -1045,8 +1052,10 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -1045,8 +1052,10 @@ static void RunThread( vout_thread_t *p_vout)
if( display_date > 0 ) if( display_date > 0 )
{ {
if( !p_input ) if( !p_input )
{
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT,
FIND_PARENT ); FIND_PARENT );
}
p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date, p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date,
p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : VLC_FALSE ); p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : VLC_FALSE );
} }
...@@ -1197,6 +1206,11 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -1197,6 +1206,11 @@ static void RunThread( vout_thread_t *p_vout)
} }
} }
if( p_input )
{
vlc_object_release( p_input );
}
/* /*
* Error loop - wait until the thread destruction is requested * Error loop - wait until the thread destruction is requested
*/ */
......
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