[vlc-commits] input: resource: remove useless lock
Thomas Guillem
git at videolan.org
Mon Jul 6 08:47:49 CEST 2020
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jun 30 10:28:27 2020 +0200| [91edd5c91fa25e18d7cb64cb1ab885dabc9b2707] | committer: Thomas Guillem
input: resource: remove useless lock
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'.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91edd5c91fa25e18d7cb64cb1ab885dabc9b2707
---
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 79b42bf07c..e145a88342 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
More information about the vlc-commits
mailing list