[vlc-commits] resource: move input_resource_PutVout up

Thomas Guillem git at videolan.org
Fri May 10 09:51:23 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May  9 15:25:23 2019 +0200| [7bcd34ff1ffdb6e2600071f86e07a0bf73709de5] | committer: Thomas Guillem

resource: move input_resource_PutVout up

And add its locked version: into input_resource_PutVoutLocked.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7bcd34ff1ffdb6e2600071f86e07a0bf73709de5
---

 src/input/resource.c | 50 ++++++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/src/input/resource.c b/src/input/resource.c
index 80d27f462c..45fd4eec54 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -325,6 +325,34 @@ void input_resource_SetInput( input_resource_t *p_resource, input_thread_t *p_in
     vlc_mutex_unlock( &p_resource->lock );
 }
 
+static void input_resource_PutVoutLocked(input_resource_t *p_resource,
+                                         vout_thread_t *vout)
+{
+    assert(vout != NULL);
+
+    vlc_mutex_lock(&p_resource->lock_hold);
+    TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, vout);
+
+    const int active_vouts = p_resource->i_vout;
+    vlc_mutex_unlock(&p_resource->lock_hold);
+
+    if (p_resource->p_vout_free != NULL || active_vouts > 0) {
+        msg_Dbg(p_resource->p_parent, "destroying vout (already one saved or active)");
+        vout_Close(vout);
+    } else {
+        msg_Dbg(p_resource->p_parent, "saving a free vout");
+        p_resource->p_vout_free = vout;
+    }
+}
+
+void input_resource_PutVout(input_resource_t *p_resource,
+                                   vout_thread_t *vout)
+{
+    vlc_mutex_lock( &p_resource->lock );
+    input_resource_PutVoutLocked( p_resource, vout );
+    vlc_mutex_unlock( &p_resource->lock );
+}
+
 vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
                                       const vout_configuration_t *cfg)
 {
@@ -381,28 +409,6 @@ out:
     return vout;
 }
 
-void input_resource_PutVout(input_resource_t *p_resource,
-                            vout_thread_t *vout)
-{
-    assert(vout != NULL);
-    vlc_mutex_lock( &p_resource->lock );
-
-    vlc_mutex_lock(&p_resource->lock_hold);
-    TAB_REMOVE(p_resource->i_vout, p_resource->pp_vout, vout);
-
-    const int active_vouts = p_resource->i_vout;
-    vlc_mutex_unlock(&p_resource->lock_hold);
-
-    if (p_resource->p_vout_free != NULL || active_vouts > 0) {
-        msg_Dbg(p_resource->p_parent, "destroying vout (already one saved or active)");
-        vout_Close(vout);
-    } else {
-        msg_Dbg(p_resource->p_parent, "saving a free vout");
-        p_resource->p_vout_free = vout;
-    }
-    vlc_mutex_unlock( &p_resource->lock );
-}
-
 vout_thread_t *input_resource_HoldVout( input_resource_t *p_resource )
 {
     /* TODO FIXME: p_resource->pp_vout order is NOT stable */



More information about the vlc-commits mailing list