msdkvpp: check mfx surface nullity for the input buffer
authorJulien Isorce <jisorce@oblong.com>
Fri, 6 Dec 2019 05:19:13 +0000 (21:19 -0800)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 10 Dec 2019 03:00:13 +0000 (03:00 +0000)
In theory it should not happen but it happened to me
in some cases where it failed to allocate some video
buffers so this was a consequence of a corner case.
Better to be safe than sorry.

sys/msdk/gstmsdkvpp.c

index 66b32e0..23c2dbc 100644 (file)
@@ -729,11 +729,17 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
   if (!in_surface)
     return GST_FLOW_ERROR;
 
+  if (!in_surface->surface) {
+    GST_ERROR_OBJECT (thiz, "mfx surface is NULL for the current input buffer");
+    free_msdk_surface (in_surface);
+    return GST_FLOW_ERROR;
+  }
+
   if (gst_msdk_is_msdk_buffer (outbuf)) {
     out_surface = g_slice_new0 (MsdkSurface);
     out_surface->surface = gst_msdk_get_surface_from_buffer (outbuf);
   } else {
-    GST_ERROR ("Failed to get msdk outsurface!");
+    GST_ERROR_OBJECT (thiz, "Failed to get msdk outsurface!");
     free_msdk_surface (in_surface);
     return GST_FLOW_ERROR;
   }