From 467618f8ac51aa7c17aec9797700fd6cc36fe518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Sat, 19 Sep 2020 14:08:46 +0200 Subject: [PATCH] va: decoder: render picture only if data Call vaRenderPicture() only if buffer or slice data is available. Part-of: --- sys/va/gstvadecoder.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sys/va/gstvadecoder.c b/sys/va/gstvadecoder.c index ec150ee82d..1d74518724 100644 --- a/sys/va/gstvadecoder.c +++ b/sys/va/gstvadecoder.c @@ -586,22 +586,26 @@ gst_va_decoder_decode (GstVaDecoder * self, GstVaDecodePicture * pic) goto fail_end_pic; } - gst_va_display_lock (self->display); - status = vaRenderPicture (dpy, self->context, - (VABufferID *) pic->buffers->data, pic->buffers->len); - gst_va_display_unlock (self->display); - if (status != VA_STATUS_SUCCESS) { - GST_WARNING_OBJECT (self, "vaRenderPicture: %s", vaErrorStr (status)); - goto fail_end_pic; + if (pic->buffers->len > 0) { + gst_va_display_lock (self->display); + status = vaRenderPicture (dpy, self->context, + (VABufferID *) pic->buffers->data, pic->buffers->len); + gst_va_display_unlock (self->display); + if (status != VA_STATUS_SUCCESS) { + GST_WARNING_OBJECT (self, "vaRenderPicture: %s", vaErrorStr (status)); + goto fail_end_pic; + } } - gst_va_display_lock (self->display); - status = vaRenderPicture (dpy, self->context, - (VABufferID *) pic->slices->data, pic->slices->len); - gst_va_display_unlock (self->display); - if (status != VA_STATUS_SUCCESS) { - GST_WARNING_OBJECT (self, "vaRenderPicture: %s", vaErrorStr (status)); - goto fail_end_pic; + if (pic->slices->len > 0) { + gst_va_display_lock (self->display); + status = vaRenderPicture (dpy, self->context, + (VABufferID *) pic->slices->data, pic->slices->len); + gst_va_display_unlock (self->display); + if (status != VA_STATUS_SUCCESS) { + GST_WARNING_OBJECT (self, "vaRenderPicture: %s", vaErrorStr (status)); + goto fail_end_pic; + } } gst_va_display_lock (self->display);