From: Jaeyun Date: Wed, 10 Jun 2020 04:03:22 +0000 (+0900) Subject: [Android] create info handle in private data X-Git-Tag: accepted/tizen/unified/20200629.143505~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cef6f758a769b1ddd82dc86688fbb9200ad6752c;p=platform%2Fupstream%2Fnnstreamer.git [Android] create info handle in private data create info handle when allocating private data. Signed-off-by: Jaeyun --- diff --git a/api/android/api/src/main/jni/nnstreamer-native-customfilter.c b/api/android/api/src/main/jni/nnstreamer-native-customfilter.c index e4d7874..59de9ea 100644 --- a/api/android/api/src/main/jni/nnstreamer-native-customfilter.c +++ b/api/android/api/src/main/jni/nnstreamer-native-customfilter.c @@ -66,7 +66,7 @@ nns_customfilter_priv_set_in_info (pipeline_info_s * pipe_info, JNIEnv * env, priv = (customfilter_priv_data_s *) pipe_info->priv_data; - if (priv->in_info && ml_tensors_info_is_equal (in_info, priv->in_info)) { + if (ml_tensors_info_is_equal (in_info, priv->in_info)) { /* do nothing, tensors info is equal. */ return TRUE; } @@ -76,15 +76,11 @@ nns_customfilter_priv_set_in_info (pipeline_info_s * pipe_info, JNIEnv * env, return FALSE; } + ml_tensors_info_free (priv->in_info); + ml_tensors_info_clone (priv->in_info, in_info); + if (priv->in_info_obj) (*env)->DeleteGlobalRef (env, priv->in_info_obj); - - if (priv->in_info) - ml_tensors_info_free (priv->in_info); - else - ml_tensors_info_create (&priv->in_info); - - ml_tensors_info_clone (priv->in_info, in_info); priv->in_info_obj = (*env)->NewGlobalRef (env, obj_info); (*env)->DeleteLocalRef (env, obj_info); return TRUE; @@ -346,6 +342,7 @@ nns_native_custom_initialize (JNIEnv * env, jobject thiz, jstring name) "(L" NNS_CLS_TDATA ";)L" NNS_CLS_TDATA ";"); priv->mid_info = (*env)->GetMethodID (env, pipe_info->cls, "getOutputInfo", "(L" NNS_CLS_TINFO ";)L" NNS_CLS_TINFO ";"); + ml_tensors_info_create (&priv->in_info); nns_set_priv_data (pipe_info, priv, nns_customfilter_priv_free); diff --git a/api/android/api/src/main/jni/nnstreamer-native-pipeline.c b/api/android/api/src/main/jni/nnstreamer-native-pipeline.c index c51a655..7ebacdd 100644 --- a/api/android/api/src/main/jni/nnstreamer-native-pipeline.c +++ b/api/android/api/src/main/jni/nnstreamer-native-pipeline.c @@ -80,12 +80,13 @@ nns_pipeline_sink_priv_set_out_info (element_data_s * item, JNIEnv * env, if ((priv = item->priv_data) == NULL) { priv = g_new0 (pipeline_sink_priv_data_s, 1); + ml_tensors_info_create (&priv->out_info); item->priv_data = priv; item->priv_destroy_func = nns_pipeline_sink_priv_free; } - if (priv->out_info && ml_tensors_info_is_equal (out_info, priv->out_info)) { + if (ml_tensors_info_is_equal (out_info, priv->out_info)) { /* do nothing, tensors info is equal. */ return TRUE; } @@ -95,15 +96,11 @@ nns_pipeline_sink_priv_set_out_info (element_data_s * item, JNIEnv * env, return FALSE; } + ml_tensors_info_free (priv->out_info); + ml_tensors_info_clone (priv->out_info, out_info); + if (priv->out_info_obj) (*env)->DeleteGlobalRef (env, priv->out_info_obj); - - if (priv->out_info) - ml_tensors_info_free (priv->out_info); - else - ml_tensors_info_create (&priv->out_info); - - ml_tensors_info_clone (priv->out_info, out_info); priv->out_info_obj = (*env)->NewGlobalRef (env, obj_info); (*env)->DeleteLocalRef (env, obj_info); return TRUE; diff --git a/api/android/api/src/main/jni/nnstreamer-native-singleshot.c b/api/android/api/src/main/jni/nnstreamer-native-singleshot.c index 6fd9037..c708fce 100644 --- a/api/android/api/src/main/jni/nnstreamer-native-singleshot.c +++ b/api/android/api/src/main/jni/nnstreamer-native-singleshot.c @@ -59,7 +59,7 @@ nns_singleshot_priv_set_out_info (pipeline_info_s * pipe_info, JNIEnv * env, priv = (singleshot_priv_data_s *) pipe_info->priv_data; - if (priv->out_info && ml_tensors_info_is_equal (out_info, priv->out_info)) { + if (ml_tensors_info_is_equal (out_info, priv->out_info)) { /* do nothing, tensors info is equal. */ return TRUE; } @@ -69,15 +69,11 @@ nns_singleshot_priv_set_out_info (pipeline_info_s * pipe_info, JNIEnv * env, return FALSE; } + ml_tensors_info_free (priv->out_info); + ml_tensors_info_clone (priv->out_info, out_info); + if (priv->out_info_obj) (*env)->DeleteGlobalRef (env, priv->out_info_obj); - - if (priv->out_info) - ml_tensors_info_free (priv->out_info); - else - ml_tensors_info_create (&priv->out_info); - - ml_tensors_info_clone (priv->out_info, out_info); priv->out_info_obj = (*env)->NewGlobalRef (env, obj_info); (*env)->DeleteLocalRef (env, obj_info); return TRUE; @@ -178,6 +174,7 @@ done: ml_tensors_info_h out_info; priv = g_new0 (singleshot_priv_data_s, 1); + ml_tensors_info_create (&priv->out_info); nns_set_priv_data (pipe_info, priv, nns_singleshot_priv_free); /* set output info */