From 159562faf720d67f631c47080f852cef5316e377 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Sat, 8 Aug 2020 19:59:11 +0200 Subject: [PATCH] va: h264dec: check return value of gst_va_handle_set_context() Part-of: --- sys/va/gstvah264dec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/va/gstvah264dec.c b/sys/va/gstvah264dec.c index a99a5cb..1201b72 100644 --- a/sys/va/gstvah264dec.c +++ b/sys/va/gstvah264dec.c @@ -1300,13 +1300,16 @@ gst_va_h264_dec_set_context (GstElement * element, GstContext * context) GstVaDisplay *old_display, *new_display; GstVaH264Dec *self = GST_VA_H264_DEC (element); GstVaH264DecClass *klass = GST_VA_H264_DEC_GET_CLASS (self); + gboolean ret; old_display = self->display ? gst_object_ref (self->display) : NULL; - gst_va_handle_set_context (element, context, klass->render_device_path, + ret = gst_va_handle_set_context (element, context, klass->render_device_path, &self->display); new_display = self->display ? gst_object_ref (self->display) : NULL; - if (old_display && new_display && old_display != new_display && self->decoder) { + if (!ret + || (old_display && new_display && old_display != new_display + && self->decoder)) { GST_ELEMENT_WARNING (element, RESOURCE, BUSY, ("Can't replace VA display while operating"), (NULL)); } -- 2.7.4