mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
androidcamera: Small refactor in case open doesn't throw an exception but returns null
This commit is contained in:
parent
acfb1c44a7
commit
11b28224b5
1 changed files with 21 additions and 20 deletions
|
@ -1790,15 +1790,16 @@ gst_ah_camera_get_parameters (GstAHCamera * self)
|
||||||
GstAHCParameters *params = NULL;
|
GstAHCParameters *params = NULL;
|
||||||
|
|
||||||
object = AHC_CALL (return NULL, Object, getParameters);
|
object = AHC_CALL (return NULL, Object, getParameters);
|
||||||
|
if (object) {
|
||||||
params = g_slice_new0 (GstAHCParameters);
|
params = g_slice_new0 (GstAHCParameters);
|
||||||
params->object = (*env)->NewGlobalRef (env, object);
|
params->object = (*env)->NewGlobalRef (env, object);
|
||||||
(*env)->DeleteLocalRef (env, object);
|
(*env)->DeleteLocalRef (env, object);
|
||||||
if (!params->object) {
|
if (!params->object) {
|
||||||
GST_ERROR ("Failed to create global reference");
|
GST_ERROR ("Failed to create global reference");
|
||||||
(*env)->ExceptionClear (env);
|
(*env)->ExceptionClear (env);
|
||||||
g_slice_free (GstAHCParameters, params);
|
g_slice_free (GstAHCParameters, params);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
|
@ -1822,20 +1823,20 @@ gst_ah_camera_open (gint camera_id)
|
||||||
GstAHCamera *camera = NULL;
|
GstAHCamera *camera = NULL;
|
||||||
|
|
||||||
object = AHC_STATIC_CALL (goto done, Object, open, camera_id);
|
object = AHC_STATIC_CALL (goto done, Object, open, camera_id);
|
||||||
|
if (object) {
|
||||||
camera = g_slice_new0 (GstAHCamera);
|
camera = g_slice_new0 (GstAHCamera);
|
||||||
camera->object = (*env)->NewGlobalRef (env, object);
|
camera->object = (*env)->NewGlobalRef (env, object);
|
||||||
(*env)->DeleteLocalRef (env, object);
|
(*env)->DeleteLocalRef (env, object);
|
||||||
if (!camera->object) {
|
if (!camera->object) {
|
||||||
GST_ERROR ("Failed to create global reference");
|
GST_ERROR ("Failed to create global reference");
|
||||||
(*env)->ExceptionClear (env);
|
(*env)->ExceptionClear (env);
|
||||||
g_slice_free (GstAHCamera, camera);
|
g_slice_free (GstAHCamera, camera);
|
||||||
goto done;
|
camera = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return camera;
|
|
||||||
done:
|
done:
|
||||||
return NULL;
|
return camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
Loading…
Reference in a new issue