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

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 20 15:45:04 CET 2020


The rest of vout_ReleaseDisplay() 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 | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 74602e09c76..a92c185275f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1919,12 +1919,25 @@ static void *Thread(void *object)
     }
 }
 
-static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
+static void vout_ReleaseDisplayAlone(vout_thread_sys_t *vout)
 {
     vout_thread_sys_t *sys = 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_ReleaseDisplay(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_ReleaseDisplayAlone(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)
-- 
2.26.2



More information about the vlc-devel mailing list