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

bridge: convert to static lock

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 9d853495
...@@ -167,6 +167,7 @@ typedef struct bridge_t ...@@ -167,6 +167,7 @@ typedef struct bridge_t
int i_es_num; int i_es_num;
} bridge_t; } bridge_t;
static vlc_mutex_t lock = VLC_STATIC_MUTEX;
/* /*
* Bridge out * Bridge out
...@@ -174,7 +175,6 @@ typedef struct bridge_t ...@@ -174,7 +175,6 @@ typedef struct bridge_t
typedef struct out_sout_stream_sys_t typedef struct out_sout_stream_sys_t
{ {
vlc_mutex_t *p_lock;
bridged_es_t *p_es; bridged_es_t *p_es;
int i_id; int i_id;
bool b_inited; bool b_inited;
...@@ -199,10 +199,6 @@ static int OpenOut( vlc_object_t *p_this ) ...@@ -199,10 +199,6 @@ static int OpenOut( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys->b_inited = false; p_sys->b_inited = false;
var_Create( p_this->p_libvlc, "bridge-lock", VLC_VAR_MUTEX );
var_Get( p_this->p_libvlc, "bridge-lock", &val );
p_sys->p_lock = val.p_address;
var_Get( p_stream, SOUT_CFG_PREFIX_OUT "id", &val ); var_Get( p_stream, SOUT_CFG_PREFIX_OUT "id", &val );
p_sys->i_id = val.i_int; p_sys->i_id = val.i_int;
...@@ -254,7 +250,7 @@ static sout_stream_id_t * AddOut( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -254,7 +250,7 @@ static sout_stream_id_t * AddOut( sout_stream_t *p_stream, es_format_t *p_fmt )
} }
p_sys->b_inited = true; p_sys->b_inited = true;
vlc_mutex_lock( p_sys->p_lock ); vlc_mutex_lock( &lock );
p_bridge = var_GetAddress( p_stream->p_libvlc, p_sys->psz_name ); p_bridge = var_GetAddress( p_stream->p_libvlc, p_sys->psz_name );
if ( p_bridge == NULL ) if ( p_bridge == NULL )
...@@ -297,7 +293,7 @@ static sout_stream_id_t * AddOut( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -297,7 +293,7 @@ static sout_stream_id_t * AddOut( sout_stream_t *p_stream, es_format_t *p_fmt )
msg_Dbg( p_stream, "bridging out input codec=%4.4s id=%d pos=%d", msg_Dbg( p_stream, "bridging out input codec=%4.4s id=%d pos=%d",
(char*)&p_es->fmt.i_codec, p_es->fmt.i_id, i ); (char*)&p_es->fmt.i_codec, p_es->fmt.i_id, i );
vlc_mutex_unlock( p_sys->p_lock ); vlc_mutex_unlock( &lock );
return (sout_stream_id_t *)p_sys; return (sout_stream_id_t *)p_sys;
} }
...@@ -313,7 +309,7 @@ static int DelOut( sout_stream_t *p_stream, sout_stream_id_t *id ) ...@@ -313,7 +309,7 @@ static int DelOut( sout_stream_t *p_stream, sout_stream_id_t *id )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
vlc_mutex_lock( p_sys->p_lock ); vlc_mutex_lock( &lock );
p_es = p_sys->p_es; p_es = p_sys->p_es;
...@@ -322,7 +318,7 @@ static int DelOut( sout_stream_t *p_stream, sout_stream_id_t *id ) ...@@ -322,7 +318,7 @@ static int DelOut( sout_stream_t *p_stream, sout_stream_id_t *id )
p_es->p_block = false; p_es->p_block = false;
p_es->b_changed = true; p_es->b_changed = true;
vlc_mutex_unlock( p_sys->p_lock ); vlc_mutex_unlock( &lock );
p_sys->b_inited = false; p_sys->b_inited = false;
...@@ -341,7 +337,7 @@ static int SendOut( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -341,7 +337,7 @@ static int SendOut( sout_stream_t *p_stream, sout_stream_id_t *id,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
vlc_mutex_lock( p_sys->p_lock ); vlc_mutex_lock( &lock );
p_es = p_sys->p_es; p_es = p_sys->p_es;
*p_es->pp_last = p_buffer; *p_es->pp_last = p_buffer;
...@@ -351,7 +347,7 @@ static int SendOut( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -351,7 +347,7 @@ static int SendOut( sout_stream_t *p_stream, sout_stream_id_t *id,
p_buffer = p_buffer->p_next; p_buffer = p_buffer->p_next;
} }
vlc_mutex_unlock( p_sys->p_lock ); vlc_mutex_unlock( &lock );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -363,7 +359,6 @@ static int SendOut( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -363,7 +359,6 @@ static int SendOut( sout_stream_t *p_stream, sout_stream_id_t *id,
typedef struct in_sout_stream_sys_t typedef struct in_sout_stream_sys_t
{ {
vlc_mutex_t *p_lock;
int i_id_offset; int i_id_offset;
mtime_t i_delay; mtime_t i_delay;
...@@ -404,10 +399,6 @@ static int OpenIn( vlc_object_t *p_this ) ...@@ -404,10 +399,6 @@ static int OpenIn( vlc_object_t *p_this )
config_ChainParse( p_stream, SOUT_CFG_PREFIX_IN, ppsz_sout_options_in, config_ChainParse( p_stream, SOUT_CFG_PREFIX_IN, ppsz_sout_options_in,
p_stream->p_cfg ); p_stream->p_cfg );
var_Create( p_this->p_libvlc, "bridge-lock", VLC_VAR_MUTEX );
var_Get( p_this->p_libvlc, "bridge-lock", &val );
p_sys->p_lock = val.p_address;
var_Get( p_stream, SOUT_CFG_PREFIX_IN "id-offset", &val ); var_Get( p_stream, SOUT_CFG_PREFIX_IN "id-offset", &val );
p_sys->i_id_offset = val.i_int; p_sys->i_id_offset = val.i_int;
...@@ -533,7 +524,7 @@ static int SendIn( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -533,7 +524,7 @@ static int SendIn( sout_stream_t *p_stream, sout_stream_id_t *id,
p_stream->p_next->pf_send( p_stream->p_next, id->id, p_buffer ); p_stream->p_next->pf_send( p_stream->p_next, id->id, p_buffer );
/* Then check all bridged streams */ /* Then check all bridged streams */
vlc_mutex_lock( p_sys->p_lock ); vlc_mutex_lock( &lock );
p_bridge = var_GetAddress( p_stream->p_libvlc, p_sys->psz_name ); p_bridge = var_GetAddress( p_stream->p_libvlc, p_sys->psz_name );
...@@ -711,7 +702,7 @@ static int SendIn( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -711,7 +702,7 @@ static int SendIn( sout_stream_t *p_stream, sout_stream_id_t *id,
} }
} }
vlc_mutex_unlock( p_sys->p_lock ); vlc_mutex_unlock( &lock );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
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