[vlc-devel] [PATCH] vdpau: depends on VDPAU dec device

Thomas Guillem thomas at gllm.fr
Wed Oct 9 11:37:40 CEST 2019


This fixes crashes when this va was used without a valid VDPAU dec device.
---
 modules/hw/vdpau/avcodec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 33ac52c0cb..59ed1289ae 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -140,7 +140,8 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *d
                 const es_format_t *fmt, vlc_decoder_device *dec_device,
                 vlc_video_context **vtcx_out)
 {
-    if (pix_fmt != AV_PIX_FMT_VDPAU)
+    if (pix_fmt != AV_PIX_FMT_VDPAU || dec_device == NULL ||
+        dec_device->type != VLC_DECODER_DEVICE_VDPAU)
         return VLC_EGENERIC;
 
     (void) fmt;
-- 
2.20.1



More information about the vlc-devel mailing list