[vlc-devel] [PATCH 9/9] video_output: add a function to release the display separately from its thread

Steve Lhomme robux4 at ycbcr.xyz
Thu Oct 10 16:27:04 CEST 2019


---
 src/video_output/video_output.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 08fdc8a80db..32cc2c56d3d 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1690,13 +1690,11 @@ noreturn static void *Thread(void *object)
     }
 }
 
-void vout_StopDisplay(vout_thread_t *vout)
+static void VoutReleaseDisplay(vout_thread_t *vout)
 {
     vout_thread_sys_t *sys = vout->p;
 
     assert(sys->display != NULL);
-    vlc_cancel(sys->thread);
-    vlc_join(sys->thread, NULL);
 
     if (sys->spu_blend != NULL)
         filter_DeleteBlend(sys->spu_blend);
@@ -1734,6 +1732,16 @@ void vout_StopDisplay(vout_thread_t *vout)
     video_format_Clean(&sys->original);
 }
 
+void vout_StopDisplay(vout_thread_t *vout)
+{
+    vout_thread_sys_t *sys = vout->p;
+
+    vlc_cancel(sys->thread);
+    vlc_join(sys->thread, NULL);
+
+    VoutReleaseDisplay(vout);
+}
+
 static void VoutDisableWindow(vout_thread_t *vout)
 {
     vout_thread_sys_t *sys = vout->p;
@@ -2025,7 +2033,8 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
     }
     if (vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
         msg_Err(vout, "video output thread creation failed");
-        vout_Stop(vout);
+        VoutReleaseDisplay(vout);
+        VoutDisableWindow(vout);
         return -1;
     }
 
-- 
2.17.1



More information about the vlc-devel mailing list