mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
androidcamera: Be NULL-safe when a JNI list is returned
This commit is contained in:
parent
dae0337d91
commit
39d7729476
1 changed files with 145 additions and 115 deletions
|
@ -2680,11 +2680,13 @@ gst_ahc_parameters_get_supported_antibanding (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedAntibanding);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2700,6 +2702,7 @@ gst_ahc_parameters_get_supported_antibanding (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2715,11 +2718,13 @@ gst_ahc_parameters_get_supported_color_effects (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedColorEffects);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2735,6 +2740,7 @@ gst_ahc_parameters_get_supported_color_effects (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2750,11 +2756,13 @@ gst_ahc_parameters_get_supported_flash_modes (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedFlashModes);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2770,6 +2778,7 @@ gst_ahc_parameters_get_supported_flash_modes (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2785,11 +2794,13 @@ gst_ahc_parameters_get_supported_focus_modes (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedFocusModes);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2805,6 +2816,7 @@ gst_ahc_parameters_get_supported_focus_modes (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2820,11 +2832,13 @@ gst_ahc_parameters_get_supported_preview_formats (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedPreviewFormats);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2840,6 +2854,7 @@ gst_ahc_parameters_get_supported_preview_formats (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2855,11 +2870,13 @@ gst_ahc_parameters_get_supported_preview_fps_range (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedPreviewFpsRange);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2876,6 +2893,7 @@ gst_ahc_parameters_get_supported_preview_fps_range (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2891,11 +2909,13 @@ gst_ahc_parameters_get_supported_preview_sizes (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedPreviewSizes);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2916,6 +2936,7 @@ gst_ahc_parameters_get_supported_preview_sizes (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2931,11 +2952,13 @@ gst_ahc_parameters_get_supported_scene_modes (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedSceneModes);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2951,6 +2974,7 @@ gst_ahc_parameters_get_supported_scene_modes (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2966,11 +2990,13 @@ gst_ahc_parameters_get_supported_white_balance (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getSupportedWhiteBalance);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -2986,6 +3012,7 @@ gst_ahc_parameters_get_supported_white_balance (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -3040,11 +3067,13 @@ gst_ahc_parameters_get_zoom_ratios (GstAHCParameters * self)
|
|||
{
|
||||
JNIEnv *env = gst_dvm_get_env ();
|
||||
jobject list = NULL;
|
||||
jobject iterator = NULL;
|
||||
GList *ret = NULL;
|
||||
|
||||
list = AHCP_CALL (return NULL, Object, getZoomRatios);
|
||||
|
||||
if (list) {
|
||||
jobject iterator = NULL;
|
||||
|
||||
iterator = java_util_list_iterator (env, list);
|
||||
if (iterator) {
|
||||
while (java_util_iterator_has_next (env, iterator)) {
|
||||
|
@ -3060,6 +3089,7 @@ gst_ahc_parameters_get_zoom_ratios (GstAHCParameters * self)
|
|||
(*env)->DeleteLocalRef (env, iterator);
|
||||
}
|
||||
(*env)->DeleteLocalRef (env, list);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue