[vlc-commits] input: fix deadlock when pausing a not started vout

Thomas Guillem git at videolan.org
Fri May 10 14:36:32 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri May 10 11:00:24 2019 +0200| [7c2ded7ad0754b59e18d7744c7936fea5a7db555] | committer: Thomas Guillem

input: fix deadlock when pausing a not started vout

Regression from ad183c8ffc20b964d5b0fb66c47d2dfb3f92fb06

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

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

diff --git a/src/input/resource.c b/src/input/resource.c
index 70942b5317..bf5a4d2b57 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -344,7 +344,7 @@ void input_resource_SetInput( input_resource_t *p_resource, input_thread_t *p_in
 }
 
 static void input_resource_PutVoutLocked(input_resource_t *p_resource,
-                                         vout_thread_t *vout)
+                                         vout_thread_t *vout, bool started)
 {
     assert(vout != NULL);
     vlc_mutex_lock(&p_resource->lock_hold);
@@ -357,9 +357,12 @@ static void input_resource_PutVoutLocked(input_resource_t *p_resource,
         assert(p_resource->p_vout_free == NULL);
         assert(!p_resource->b_vout_free_paused);
         msg_Dbg(p_resource->p_parent, "saving a free vout");
-        vout_Pause(vout);
         p_resource->p_vout_free = vout;
-        p_resource->b_vout_free_paused = true;
+        if (started)
+        {
+            vout_Pause(vout);
+            p_resource->b_vout_free_paused = true;
+        }
     }
     else
     {
@@ -382,7 +385,7 @@ 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 );
+    input_resource_PutVoutLocked( p_resource, vout, true );
     vlc_mutex_unlock( &p_resource->lock );
 }
 
@@ -430,7 +433,7 @@ vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
 #endif
 
     if (vout_Request(cfg, p_resource->p_input)) {
-        input_resource_PutVoutLocked(p_resource, cfg->vout);
+        input_resource_PutVoutLocked(p_resource, cfg->vout, false);
         vlc_mutex_unlock(&p_resource->lock);
         return NULL;
     }



More information about the vlc-commits mailing list