va: h264dec: check return value of gst_va_handle_set_context()
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sat, 8 Aug 2020 17:59:11 +0000 (19:59 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 10 Aug 2020 15:36:47 +0000 (15:36 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1499>

sys/va/gstvah264dec.c

index a99a5cb17b78d42ef5683813c3fe9aba479d7629..1201b7256befae96cbbe0c2a282fcf87178301b4 100644 (file)
@@ -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));
   }