[vlc-devel] [PATCH 01/11] input: resource: remove useless lock
Thomas Guillem
thomas at gllm.fr
Tue Jun 30 17:27:12 CEST 2020
cf. comment on the input_resource_t struct : p_resource->pp_vout[0] can be read
with 'lock', p_vout_free can be read/write with 'lock', not needing
'lock_hold'.
---
src/input/resource.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/input/resource.c b/src/input/resource.c
index 79b42bf07cb..e145a88342c 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -326,13 +326,10 @@ static void input_resource_PutVoutLocked(input_resource_t *p_resource,
vout_thread_t *vout)
{
assert(vout != NULL);
- vlc_mutex_lock(&p_resource->lock_hold);
assert( p_resource->i_vout > 0 );
if (p_resource->pp_vout[0] == vout)
{
- vlc_mutex_unlock(&p_resource->lock_hold);
-
assert(p_resource->p_vout_free == NULL || p_resource->p_vout_free == vout);
msg_Dbg(p_resource->p_parent, "saving a free vout");
p_resource->p_vout_free = vout;
@@ -348,6 +345,7 @@ static void input_resource_PutVoutLocked(input_resource_t *p_resource,
}
#endif
+ vlc_mutex_lock(&p_resource->lock_hold);
TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, vout);
vlc_mutex_unlock(&p_resource->lock_hold);
vout_Stop(vout);
@@ -399,14 +397,12 @@ vout_thread_t *input_resource_GetVoutDecoderDevice(input_resource_t *p_resource,
}
else
{
- vlc_mutex_lock(&p_resource->lock_hold);
assert(p_resource->i_vout > 0);
*order = p_resource->pp_vout[0] == cfg_vout ? VLC_VOUT_ORDER_PRIMARY
: VLC_VOUT_ORDER_SECONDARY;
/* the caller is going to reuse the free vout, it's not free anymore */
if (p_resource->p_vout_free == cfg_vout)
p_resource->p_vout_free = NULL;
- vlc_mutex_unlock(&p_resource->lock_hold);
}
#ifndef NDEBUG
--
2.20.1
More information about the vlc-devel
mailing list