[vlc-commits] vout: do not destroy vout on failed start

Rémi Denis-Courmont git at videolan.org
Sun Feb 24 14:57:50 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 24 15:46:17 2019 +0200| [f0982a412d4042794b93b237af2c07aa52cc2ac1] | committer: Rémi Denis-Courmont

vout: do not destroy vout on failed start

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

 src/audio_output/filters.c      | 6 +++++-
 src/input/resource.c            | 3 +++
 src/video_output/video_output.c | 9 ++-------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index d86a32a81d..0dc1fe8864 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -393,7 +393,11 @@ vout_thread_t *aout_filter_GetVout(filter_t *filter, const video_format_t *fmt)
 
     video_format_AdjustColorSpace(&adj_fmt);
 
-    return vout_Request(&cfg, NULL);
+    if (vout_Request(&cfg, NULL) == NULL) {
+        vout_Close(vout);
+        vout = NULL;
+    }
+    return vout;
 }
 
 static int AppendFilter(vlc_object_t *obj, const char *type, const char *name,
diff --git a/src/input/resource.c b/src/input/resource.c
index 9db0ce70d3..0127a853d2 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -418,6 +418,9 @@ vout_thread_t *input_resource_GetVout(input_resource_t *p_resource,
                     .action = VLC_INPUT_EVENT_VOUT_ADDED,
                     .vout = vout,
                 });
+    } else {
+       vout_Close(vout);
+       vout = NULL;
     }
 out:
     vlc_mutex_unlock( &p_resource->lock );
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 681beb4114..68553773e1 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1739,11 +1739,8 @@ vout_thread_t *vout_Request(const vout_configuration_t *cfg,
     assert(vout != NULL);
     assert(cfg->fmt != NULL);
 
-    if (!VoutCheckFormat(cfg->fmt)) {
-        if (vout != NULL)
-            vout_Close(vout);
+    if (!VoutCheckFormat(cfg->fmt))
         return NULL;
-    }
 
     video_format_t original;
     VoutFixFormat(&original, cfg->fmt);
@@ -1802,9 +1799,7 @@ vout_thread_t *vout_Request(const vout_configuration_t *cfg,
      || vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
 error:
         msg_Err(vout, "video output creation failed");
-        vout_display_window_Delete(sys->display_cfg.window);
-        spu_Destroy(sys->spu);
-        vlc_object_release(vout);
+        video_format_Clean(&sys->original);
         return NULL;
     }
 



More information about the vlc-commits mailing list