[vlc-devel] [PATCH] video_output: separate the error logs and return in vout_Request

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 11 11:47:01 CEST 2019


No need to stop the vout (thread, display) when failing to enable the window.
If there wasn't an enabled window, there wasn't any of them.

vout_Stop already clean sys->original, so no need to do it again.
---
 src/video_output/video_output.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 45374ec71aa..e187d0b3a47 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1977,7 +1977,9 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
 
         if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
             vlc_mutex_unlock(&sys->window_lock);
-            goto error;
+            msg_Err(vout, "failed to enable window");
+            video_format_Clean(&sys->original);
+            return -1;
         }
         sys->window_enabled = true;
     } else
@@ -1992,14 +1994,14 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
 
     if (vout_Start(vout, cfg))
     {
+        msg_Err(vout, "video output display creation failed");
+        video_format_Clean(&sys->original);
         vout_DisableWindow(vout);
-        goto error;
+        return -1;
     }
     if (vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
+        msg_Err(vout, "video output thread creation failed");
         vout_Stop(vout);
-error:
-        msg_Err(vout, "video output creation failed");
-        video_format_Clean(&sys->original);
         return -1;
     }
 
-- 
2.17.1



More information about the vlc-devel mailing list