[vlc-devel] [PATCH v2 14/18] video_output: group the code to release/unload the display module in a function

Steve Lhomme robux4 at ycbcr.xyz
Tue Nov 24 11:46:37 CET 2020


The rest of vout_ReleaseDisplayAndFilters (formerly vout_ReleaseDisplayAndFilters)
also deals with filters, mouse handling, decoder FIFO, etc.

The display module is flushed unconditionally (effectively the converters
filter chain).
---
 src/video_output/video_output.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index e61a41ab880..b791b3e2751 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1925,6 +1925,19 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
 
     assert(sys->display != NULL);
 
+    vout_FilterFlush(sys->display);
+
+    vout_CloseWrapper(&vout->obj, &sys->private, sys->display);
+    sys->display = NULL;
+    assert(sys->private.display_pool == NULL);
+
+    video_format_Clean(&sys->original);
+}
+
+static void vout_ReleaseDisplayAndFilters(vout_thread_sys_t *vout)
+{
+    vout_thread_sys_t *sys = vout;
+
     if (sys->spu_blend != NULL)
         filter_DeleteBlend(sys->spu_blend);
 
@@ -1933,8 +1946,7 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
         vout_FlushUnlocked(vout, true, INT64_MAX);
 
     vlc_mutex_lock(&sys->display_lock);
-    vout_CloseWrapper(&vout->obj, &sys->private, sys->display);
-    sys->display = NULL;
+    vout_ReleaseDisplay(vout);
     vlc_mutex_unlock(&sys->display_lock);
 
     /* Destroy the video filters */
@@ -1954,7 +1966,6 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
         picture_fifo_Delete(sys->decoder_fifo);
         sys->decoder_fifo = NULL;
     }
-    assert(sys->private.display_pool == NULL);
 
     if (sys->mouse_event)
     {
@@ -1965,7 +1976,6 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
     if (sys->spu)
         spu_Detach(sys->spu);
     sys->clock = NULL;
-    video_format_Clean(&sys->original);
 }
 
 void vout_StopDisplay(vout_thread_t *vout)
@@ -1975,7 +1985,7 @@ void vout_StopDisplay(vout_thread_t *vout)
     vout_control_PushVoid(&sys->control, VOUT_CONTROL_TERMINATE);
     vlc_join(sys->thread, NULL);
 
-    vout_ReleaseDisplay(sys);
+    vout_ReleaseDisplayAndFilters(sys);
 }
 
 static void vout_DisableWindow(vout_thread_sys_t *sys)
@@ -2307,7 +2317,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
         return -1;
     }
     if (vlc_clone(&sys->thread, Thread, vout, VLC_THREAD_PRIORITY_OUTPUT)) {
-        vout_ReleaseDisplay(vout);
+        vout_ReleaseDisplayAndFilters(vout);
         vout_DisableWindow(vout);
         return -1;
     }
-- 
2.26.2



More information about the vlc-devel mailing list