From: Sangjung Woo Date: Fri, 19 Jul 2019 09:45:14 +0000 (+0900) Subject: [C-API] check gstreamer initialization status in ml_single_open() X-Git-Tag: accepted/tizen/unified/20190723.112130^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a819173123f8b608dd6b28ff48a1d78b8205193;p=platform%2Fupstream%2Fnnstreamer.git [C-API] check gstreamer initialization status in ml_single_open() Before calling gstreamer function, this patch checks its initialization status by calling gst_init_check() in ml_single_open(). Signed-off-by: Sangjung Woo --- diff --git a/api/capi/src/nnstreamer-capi-single.c b/api/capi/src/nnstreamer-capi-single.c index aeed7a6..0553f0e 100644 --- a/api/capi/src/nnstreamer-capi-single.c +++ b/api/capi/src/nnstreamer-capi-single.c @@ -57,6 +57,7 @@ ml_single_open (ml_single_h * single, const char *model, ml_pipeline *pipe_h; GstElement *appsrc, *appsink, *filter; GstCaps *caps; + GError *err = NULL; int status = ML_ERROR_NONE; gchar *pipeline_desc = NULL; gchar *path_down; @@ -73,6 +74,16 @@ ml_single_open (ml_single_h * single, const char *model, /* init null */ *single = NULL; + if (FALSE == gst_init_check (NULL, NULL, &err)) { + if (err) { + ml_loge ("GStreamer has the following error: %s", err->message); + g_error_free (err); + } else { + ml_loge ("Cannot initialize GStreamer. Unknown reason."); + } + return ML_ERROR_STREAMS_PIPE; + } + in_tensors_info = (ml_tensors_info_s *) input_info; out_tensors_info = (ml_tensors_info_s *) output_info;