faceblur: Release memory storage

And also release cvImages and memory storage when changing caps or reusing the
element.
This commit is contained in:
Sebastian Dröge 2014-06-30 00:07:22 +02:00
parent 48e95f3d6f
commit ae1027297c

View file

@ -121,6 +121,7 @@ gst_face_blur_finalize (GObject * obj)
if (filter->cvImage) {
cvReleaseImage (&filter->cvImage);
cvReleaseImage (&filter->cvGray);
cvReleaseMemStorage (&filter->cvStorage);
}
g_free (filter->profile);
@ -241,6 +242,12 @@ gst_face_blur_handle_sink_event (GstPad * pad, GstObject * parent,
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);
if (filter->cvImage) {
cvReleaseImage (&filter->cvImage);
cvReleaseImage (&filter->cvGray);
cvReleaseMemStorage (&filter->cvStorage);
}
filter->cvImage = cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 3);
filter->cvGray = cvCreateImage (cvSize (width, height), IPL_DEPTH_8U, 1);
filter->cvStorage = cvCreateMemStorage (0);