[vlc-devel] [PATCH V2 05/17] resource: add input_resource_HoldVoutLocked

Thomas Guillem thomas at gllm.fr
Tue Apr 16 16:25:15 CEST 2019


---
 src/input/resource.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/input/resource.c b/src/input/resource.c
index 6db68a6835..bc83f51e07 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -394,20 +394,25 @@ void input_resource_PutVout(input_resource_t *p_resource,
     vlc_mutex_unlock( &p_resource->lock );
 }
 
-vout_thread_t *input_resource_HoldVout( input_resource_t *p_resource )
+static vout_thread_t *
+input_resource_HoldVoutLocked( input_resource_t *p_resource )
 {
     /* TODO FIXME: p_resource->pp_vout order is NOT stable */
-    vlc_mutex_lock( &p_resource->lock );
-
     vout_thread_t *p_vout = p_resource->i_vout > 0 ? p_resource->pp_vout[0] : NULL;
     if( p_vout )
         vout_Hold(p_vout);
 
-    vlc_mutex_unlock( &p_resource->lock );
-
     return p_vout;
 }
 
+vout_thread_t *input_resource_HoldVout( input_resource_t *p_resource )
+{
+    vlc_mutex_lock( &p_resource->lock );
+    vout_thread_t *vout = input_resource_HoldVoutLocked( p_resource );
+    vlc_mutex_unlock( &p_resource->lock );
+    return vout;
+}
+
 void input_resource_HoldVouts( input_resource_t *p_resource, vout_thread_t ***ppp_vout,
                                size_t *pi_vout )
 {
-- 
2.20.1



More information about the vlc-devel mailing list