[vlc-devel] [PATCH 1/7] video output: setup interruption context in vout

Alexandre Janniaux ajanni at videolabs.io
Wed Feb 10 11:23:17 UTC 2021


Some display are doing IO (eg. texture synchronization, WSI details) and
might be waiting within the prepare/display code. Install an
interruption context to allow notifying them that we're gonna kill them.
---
 src/video_output/video_output.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index d04d3f4d11..d1eaf81242 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -49,6 +49,7 @@
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_atomic.h>
+#include <vlc_interrupt.h>
 
 #include <libvlc.h>
 #include "vout_private.h"
@@ -162,6 +163,7 @@ typedef struct vout_thread_sys_t
     vout_chrono_t   render;           /**< picture render time estimator */
     vout_chrono_t   static_filter;
 
+    vlc_interrupt_t *interrupt;
     vlc_atomic_rc_t rc;
 
 } vout_thread_sys_t;
@@ -1763,6 +1765,8 @@ static void *Thread(void *object)
     vlc_tick_t deadline = VLC_TICK_INVALID;
     bool wait = false;
 
+    vlc_interrupt_set(sys->interrupt);
+
     for (;;) {
         if (wait)
         {
@@ -1848,9 +1852,11 @@ void vout_StopDisplay(vout_thread_t *vout)
     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
 
     atomic_store(&sys->control_is_terminated, true);
+    vlc_interrupt_kill(sys->interrupt);
     // wake up so it goes back to the loop that will detect the terminated state
     vout_control_Wake(&sys->control);
     vlc_join(sys->thread, NULL);
+    vlc_interrupt_destroy(sys->interrupt);
 
     vout_ReleaseDisplay(sys);
 }
@@ -2147,6 +2153,14 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
 
     if (sys->display != NULL)
         vout_StopDisplay(cfg->vout);
+    sys->interrupt = vlc_interrupt_create();
+    if (sys->interrupt == NULL)
+    {
+        video_format_Clean(&original);
+        vout_DisableWindow(vout);
+        return -1;
+    }
+
 
     vout_ReinitInterlacingSupport(cfg->vout, &sys->private);
 
-- 
2.30.1



More information about the vlc-devel mailing list