[vlc-devel] [PATCH 2/4] qsv: keep the incoming decoder device

Alexandre Janniaux ajanni at videolabs.io
Thu Jul 2 16:26:13 CEST 2020


Hi,

Can you detail a bit what this patch means?

What are the downside of not using the decoder device from the
input video context or forcing the use of vlc_encoder_GetDecoderDevice
and in which use case does it applies ?

Regards,
--
Alexandre Janniaux
Videolabs

On Thu, Jul 02, 2020 at 04:18:58PM +0200, Steve Lhomme wrote:
> ---
>  modules/codec/qsv.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
> index 727f09e11cd..b04c1dcb899 100644
> --- a/modules/codec/qsv.c
> +++ b/modules/codec/qsv.c
> @@ -294,6 +294,7 @@ typedef struct
>
>      picture_pool_t   *input_pool;         // pool of pictures to feed the decoder
>                                            //  as it doesn't like constantly changing buffers
> +    vlc_decoder_device *dec_device;
>  } encoder_sys_t;
>
>  static block_t *Encode(encoder_t *, picture_t *);
> @@ -425,6 +426,11 @@ static int Open(vlc_object_t *this)
>      if (unlikely(!sys))
>          return VLC_ENOMEM;
>
> +    if (enc->vctx_in)
> +        sys->dec_device = vlc_video_context_HoldDevice(enc->vctx_in);
> +    else
> +        sys->dec_device = vlc_encoder_GetDecoderDevice(enc);
> +
>      /* Initialize dispatcher, it will loads the actual SW/HW Implementation */
>      sts = MFXInit(MFX_IMPL_AUTO_ANY, &ver, &sys->session);
>
> @@ -433,6 +439,8 @@ static int Open(vlc_object_t *this)
>              msg_Err(enc, "Intel Media SDK implementation not supported, is your card plugged?");
>          else
>              msg_Err(enc, "Unable to find an Intel Media SDK implementation (%d).", sts);
> +        if (sys->dec_device)
> +            vlc_decoder_device_Release(sys->dec_device);
>          free(sys);
>          return VLC_EGENERIC;
>      }
> @@ -650,6 +658,8 @@ static void Close(vlc_object_t *this)
>      async_task_t_fifo_Release(&sys->packets);
>      if (sys->input_pool)
>          picture_pool_Release(sys->input_pool);
> +    if (sys->dec_device)
> +        vlc_decoder_device_Release(sys->dec_device);
>      free(sys);
>  }
>
> --
> 2.26.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list