facedetect: fix profile loading check

Since the profile gchar depends on DEFAULT_FACE_PROFILE, it should never be
NULL. Furthermore CascadeClassifier accepts any input, even
an empty one, but if the profile fails to load it returns an empty cascade.
Check for this instead, and inform the user if there was an Error.
This commit is contained in:
Luis de Bethencourt 2015-08-07 15:43:53 +01:00
parent bc33d22635
commit 3a765e0805

View file

@ -801,10 +801,13 @@ gst_face_detect_load_profile (GstFaceDetect * filter, gchar * profile)
{
CascadeClassifier *cascade;
if (profile == NULL)
return NULL;
cascade = new CascadeClassifier (profile);
if (cascade->empty ()) {
GST_ERROR_OBJECT (filter, "Invalid profile file: %s", profile);
delete (cascade);
return NULL;
}
return cascade;
}