Commit c55222a8 authored by Antoine Cellerier's avatar Antoine Cellerier

Unregister a "sub filter"'s private SPU channel when destroying the

filter. Since filter destruction is always requested by the subpicture
core itself, we already have the subpicture lock so no need to lock.
parent bb03e12e
...@@ -1142,11 +1142,12 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date, ...@@ -1142,11 +1142,12 @@ subpicture_t *spu_SortSubpictures( spu_t *p_spu, mtime_t display_date,
* This function destroys the subpictures which belong to the spu channel * This function destroys the subpictures which belong to the spu channel
* corresponding to i_channel_id. * corresponding to i_channel_id.
*****************************************************************************/ *****************************************************************************/
static void SpuClearChannel( spu_t *p_spu, int i_channel ) static void SpuClearChannel( spu_t *p_spu, int i_channel, bool b_locked )
{ {
int i_subpic; /* subpicture index */ int i_subpic; /* subpicture index */
subpicture_t *p_subpic = NULL; /* first free subpicture */ subpicture_t *p_subpic = NULL; /* first free subpicture */
if( !b_locked )
vlc_mutex_lock( &p_spu->subpicture_lock ); vlc_mutex_lock( &p_spu->subpicture_lock );
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ ) for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
...@@ -1173,6 +1174,7 @@ static void SpuClearChannel( spu_t *p_spu, int i_channel ) ...@@ -1173,6 +1174,7 @@ static void SpuClearChannel( spu_t *p_spu, int i_channel )
} }
} }
if( !b_locked )
vlc_mutex_unlock( &p_spu->subpicture_lock ); vlc_mutex_unlock( &p_spu->subpicture_lock );
} }
...@@ -1192,7 +1194,7 @@ static int spu_vaControlDefault( spu_t *p_spu, int i_query, va_list args ) ...@@ -1192,7 +1194,7 @@ static int spu_vaControlDefault( spu_t *p_spu, int i_query, va_list args )
case SPU_CHANNEL_CLEAR: case SPU_CHANNEL_CLEAR:
i = (int)va_arg( args, int ); i = (int)va_arg( args, int );
SpuClearChannel( p_spu, i ); SpuClearChannel( p_spu, i, false );
break; break;
default: default:
...@@ -1364,5 +1366,7 @@ static int sub_filter_allocation_init( filter_t *p_filter, void *p_data ) ...@@ -1364,5 +1366,7 @@ static int sub_filter_allocation_init( filter_t *p_filter, void *p_data )
static void sub_filter_allocation_clear( filter_t *p_filter ) static void sub_filter_allocation_clear( filter_t *p_filter )
{ {
filter_owner_sys_t *p_sys = p_filter->p_owner;
SpuClearChannel( p_sys->p_spu, p_sys->i_channel, true );
free( p_filter->p_owner ); free( p_filter->p_owner );
} }
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