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

Rémi Denis-Courmont remi at remlab.net
Wed Feb 10 15:58:43 UTC 2021


Le keskiviikkona 10. helmikuuta 2021, 13.23.17 EET Alexandre Janniaux a écrit 
:
> 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.

The interruption thing was explicitly added to make up for the unfortunate 
design choices in the input thread. It's really not intended to be replicated 
all over the place.

And it seems like a really terrible idea in this particular case. Experience 
has shown that when video outputs lock up, they don't lock up somewhere that 
interrupt could break the lock, i.e. a poll() call or such. In other words, 
this does NOT belong in the core code.

If some display has a workable use for it, then put it in that display.

> ---
>  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);


-- 
レミ・デニ-クールモン
http://www.remlab.net/





More information about the vlc-devel mailing list