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

Convert mosaic to global mutex

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 5938da78
......@@ -480,6 +480,7 @@ enum {
VLC_AVCODEC_MUTEX = 0,
VLC_GCRYPT_MUTEX,
VLC_XLIB_MUTEX,
VLC_MOSAIC_MUTEX,
/* Insert new entry HERE */
VLC_MAX_MUTEX
};
......
......@@ -49,7 +49,6 @@
struct sout_stream_sys_t
{
bridged_es_t *p_es;
vlc_mutex_t *p_lock;
decoder_t *p_decoder;
image_handler_t *p_image; /* filter for resizing */
......@@ -192,10 +191,6 @@ static int Open( vlc_object_t *p_this )
p_stream->p_sys = p_sys;
p_sys->b_inited = false;
var_Create( p_libvlc, "mosaic-lock", VLC_VAR_MUTEX );
var_Get( p_libvlc, "mosaic-lock", &val );
p_sys->p_lock = val.p_address;
p_sys->psz_id = var_CreateGetString( p_stream, CFG_PREFIX "id" );
p_sys->i_height =
......@@ -347,7 +342,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
}
p_sys->b_inited = true;
vlc_mutex_lock( p_sys->p_lock );
vlc_global_lock( VLC_MOSAIC_MUTEX );
p_bridge = GetBridge( p_stream );
if ( p_bridge == NULL )
......@@ -391,7 +386,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
p_es->pp_last = &p_es->p_picture;
p_es->b_empty = false;
vlc_mutex_unlock( p_sys->p_lock );
vlc_global_unlock( VLC_MOSAIC_MUTEX );
if ( p_sys->i_height || p_sys->i_width )
{
......@@ -458,7 +453,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
if( p_sys->p_vf2 )
filter_chain_Delete( p_sys->p_vf2 );
vlc_mutex_lock( p_sys->p_lock );
vlc_global_lock( VLC_MOSAIC_MUTEX );
p_bridge = GetBridge( p_stream );
p_es = p_sys->p_es;
......@@ -490,7 +485,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
var_Destroy( p_libvlc, "mosaic-struct" );
}
vlc_mutex_unlock( p_sys->p_lock );
vlc_global_unlock( VLC_MOSAIC_MUTEX );
if ( p_sys->p_image )
{
......@@ -510,13 +505,13 @@ static void PushPicture( sout_stream_t *p_stream, picture_t *p_picture )
sout_stream_sys_t *p_sys = p_stream->p_sys;
bridged_es_t *p_es = p_sys->p_es;
vlc_mutex_lock( p_sys->p_lock );
vlc_global_lock( VLC_MOSAIC_MUTEX );
*p_es->pp_last = p_picture;
p_picture->p_next = NULL;
p_es->pp_last = &p_picture->p_next;
vlc_mutex_unlock( p_sys->p_lock );
vlc_global_unlock( VLC_MOSAIC_MUTEX );
}
static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
......
......@@ -58,7 +58,6 @@ static int MosaicCallback ( vlc_object_t *, char const *, vlc_value_t,
struct filter_sys_t
{
vlc_mutex_t lock; /* Internal filter lock */
vlc_mutex_t *p_lock; /* Pointer to mosaic bridge lock */
image_handler_t *p_image;
......@@ -299,10 +298,6 @@ static int CreateFilter( vlc_object_t *p_this )
vlc_mutex_init( &p_sys->lock );
vlc_mutex_lock( &p_sys->lock );
var_Create( p_libvlc, "mosaic-lock", VLC_VAR_MUTEX );
var_Get( p_libvlc, "mosaic-lock", &val );
p_sys->p_lock = val.p_address;
config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
......@@ -466,12 +461,12 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->b_absolute = false;
vlc_mutex_lock( &p_sys->lock );
vlc_mutex_lock( p_sys->p_lock );
vlc_global_lock( VLC_MOSAIC_MUTEX );
p_bridge = GetBridge( p_filter );
if ( p_bridge == NULL )
{
vlc_mutex_unlock( p_sys->p_lock );
vlc_global_unlock( VLC_MOSAIC_MUTEX );
vlc_mutex_unlock( &p_sys->lock );
return p_spu;
}
......@@ -657,7 +652,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
msg_Err( p_filter, "cannot allocate SPU region" );
p_filter->pf_sub_buffer_del( p_filter, p_spu );
vlc_mutex_unlock( p_sys->p_lock );
vlc_global_unlock( VLC_MOSAIC_MUTEX );
vlc_mutex_unlock( &p_sys->lock );
return p_spu;
}
......@@ -725,7 +720,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_region_prev = p_region;
}
vlc_mutex_unlock( p_sys->p_lock );
vlc_global_unlock( VLC_MOSAIC_MUTEX );
vlc_mutex_unlock( &p_sys->lock );
return p_spu;
......
......@@ -40,6 +40,7 @@ void vlc_global_mutex (unsigned n, bool acquire)
VLC_STATIC_MUTEX,
VLC_STATIC_MUTEX,
VLC_STATIC_MUTEX,
VLC_STATIC_MUTEX,
};
assert (n < (sizeof (locks) / sizeof (locks[0])));
vlc_mutex_t *lock = locks + n;
......
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