From b681d6f62e2c92f54374dc65b4b05112b2678824 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Thu, 5 Dec 2019 21:19:13 -0800 Subject: [PATCH] msdkvpp: check mfx surface nullity for the input buffer 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/msdk/gstmsdkvpp.c b/sys/msdk/gstmsdkvpp.c index 66b32e0821..23c2dbcba8 100644 --- a/sys/msdk/gstmsdkvpp.c +++ b/sys/msdk/gstmsdkvpp.c @@ -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; }