msdkvpp: free msdk surfaces to avoid memory leak

This commit is contained in:
Haihao Xiang 2019-08-29 09:31:22 +08:00 committed by Víctor Manuel Jáquez Leal
parent 93f72a5041
commit cc6ca4ec61

View file

@ -718,6 +718,7 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
out_surface->surface = gst_msdk_get_surface_from_buffer (outbuf); out_surface->surface = gst_msdk_get_surface_from_buffer (outbuf);
} else { } else {
GST_ERROR ("Failed to get msdk outsurface!"); GST_ERROR ("Failed to get msdk outsurface!");
free_msdk_surface (in_surface);
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
@ -770,30 +771,29 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
} }
} while (status == MFX_ERR_MORE_SURFACE); } while (status == MFX_ERR_MORE_SURFACE);
free_msdk_surface (in_surface); goto transform_end;
return ret;
vpp_error: vpp_error:
GST_ERROR_OBJECT (thiz, "MSDK Failed to do VPP"); GST_ERROR_OBJECT (thiz, "MSDK Failed to do VPP");
free_msdk_surface (in_surface); ret = GST_FLOW_ERROR;
free_msdk_surface (out_surface); goto transform_end;
return GST_FLOW_ERROR;
error_more_data: error_more_data:
GST_WARNING_OBJECT (thiz, GST_WARNING_OBJECT (thiz,
"MSDK Requries additional input for processing, " "MSDK Requries additional input for processing, "
"Retruning FLOW_DROPPED since no output buffer was generated"); "Retruning FLOW_DROPPED since no output buffer was generated");
free_msdk_surface (in_surface); ret = GST_BASE_TRANSFORM_FLOW_DROPPED;
return GST_BASE_TRANSFORM_FLOW_DROPPED; goto transform_end;
error_push_buffer: error_push_buffer:
{ GST_DEBUG_OBJECT (thiz, "failed to push output buffer: %s",
free_msdk_surface (in_surface); gst_flow_get_name (ret));
free_msdk_surface (out_surface);
GST_DEBUG_OBJECT (thiz, "failed to push output buffer: %s", transform_end:
gst_flow_get_name (ret)); free_msdk_surface (in_surface);
return ret; free_msdk_surface (out_surface);
}
return ret;
} }
static void static void