From a7fd0cc97f9a2b0d9d1421c5786fc4db83a095b8 Mon Sep 17 00:00:00 2001 From: Jaeyun Date: Fri, 17 Jul 2020 18:50:40 +0900 Subject: [PATCH] [Api/Single] init status code before invoking In invoke thread, init status (error-none) before calling the invoke callback. Signed-off-by: Jaeyun --- api/capi/src/nnstreamer-capi-single.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/capi/src/nnstreamer-capi-single.c b/api/capi/src/nnstreamer-capi-single.c index 3024c8c..0a7fe99 100644 --- a/api/capi/src/nnstreamer-capi-single.c +++ b/api/capi/src/nnstreamer-capi-single.c @@ -137,13 +137,13 @@ invoke_thread (void *arg) GstTensorMemory out_tensors[NNS_TENSOR_SIZE_LIMIT]; ml_tensors_data_s *in_data, *out_data; unsigned int i; - int status = ML_ERROR_NONE; single_h = (ml_single *) arg; g_mutex_lock (&single_h->mutex); while (single_h->state <= RUNNING) { + int status = ML_ERROR_NONE; /** wait for data */ while (single_h->state != RUNNING) { @@ -174,11 +174,12 @@ invoke_thread (void *arg) /** invoke the thread */ if (!single_h->klass->invoke (single_h->filter, in_tensors, out_tensors)) { status = ML_ERROR_STREAMS_PIPE; - g_mutex_lock (&single_h->mutex); - goto wait_for_next; } g_mutex_lock (&single_h->mutex); + if (status != ML_ERROR_NONE) + goto wait_for_next; + /** Allocate output buffer */ if (single_h->ignore_output == FALSE) { status = ml_tensors_data_create_no_alloc (&single_h->out_info, -- 2.7.4