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

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 11 15:33:15 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 cleans sys->original, so no need to do it again.
---
 src/video_output/video_output.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 45374ec71aa..be31598b3da 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,13 @@ 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)) {
         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