From 33597e06d4208acf2055027da545f7db8994f00b Mon Sep 17 00:00:00 2001 From: Jaeyun Date: Wed, 3 Jul 2019 18:04:37 +0900 Subject: [PATCH] [C-Api] remove unnecessary local value 1. remove unnecessary local variable in pipe api 2. remove unnecessary buffer count in testcases Signed-off-by: Jaeyun Jung --- api/capi/src/nnstreamer-capi-pipeline.c | 7 +++---- tests/tizen_capi/unittest_tizen_capi.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/capi/src/nnstreamer-capi-pipeline.c b/api/capi/src/nnstreamer-capi-pipeline.c index a0aea1e..ec963de 100644 --- a/api/capi/src/nnstreamer-capi-pipeline.c +++ b/api/capi/src/nnstreamer-capi-pipeline.c @@ -438,7 +438,7 @@ ml_pipeline_destroy (ml_pipeline_h pipe) { ml_pipeline *p = pipe; GstStateChangeReturn scret; - GstState state, pending; + GstState state; if (p == NULL) return ML_ERROR_INVALID_PARAMETER; @@ -446,7 +446,7 @@ ml_pipeline_destroy (ml_pipeline_h pipe) g_mutex_lock (&p->lock); /* if it's PLAYING, PAUSE it. */ - scret = gst_element_get_state (p->element, &state, &pending, 10000000UL); /* 10ms */ + scret = gst_element_get_state (p->element, &state, NULL, 10 * GST_MSECOND); /* 10ms */ if (scret != GST_STATE_CHANGE_FAILURE && state == GST_STATE_PLAYING) { /* Pause the pipeline if it's Playing */ scret = gst_element_set_state (p->element, GST_STATE_PAUSED); @@ -488,7 +488,6 @@ ml_pipeline_get_state (ml_pipeline_h pipe, ml_pipeline_state_e * state) { ml_pipeline *p = pipe; GstState _state; - GstState pending; GstStateChangeReturn scret; if (p == NULL || state == NULL) @@ -497,7 +496,7 @@ ml_pipeline_get_state (ml_pipeline_h pipe, ml_pipeline_state_e * state) *state = ML_PIPELINE_STATE_UNKNOWN; g_mutex_lock (&p->lock); - scret = gst_element_get_state (p->element, &_state, &pending, 100000UL); /* Do it within 100us! */ + scret = gst_element_get_state (p->element, &_state, NULL, GST_MSECOND); /* Do it within 1ms! */ g_mutex_unlock (&p->lock); if (scret == GST_STATE_CHANGE_FAILURE) diff --git a/tests/tizen_capi/unittest_tizen_capi.cpp b/tests/tizen_capi/unittest_tizen_capi.cpp index 1b58a70..22f103a 100644 --- a/tests/tizen_capi/unittest_tizen_capi.cpp +++ b/tests/tizen_capi/unittest_tizen_capi.cpp @@ -82,7 +82,7 @@ TEST (nnstreamer_capi_construct_destruct, failed_02) */ TEST (nnstreamer_capi_playstop, dummy_01) { - const char *pipeline = "videotestsrc is-live=true num-buffers=30 ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! valve name=valvey ! input-selector name=is01 ! tensor_sink name=sinkx"; + const char *pipeline = "videotestsrc is-live=true ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! valve name=valvey ! input-selector name=is01 ! tensor_sink name=sinkx"; ml_pipeline_h handle; ml_pipeline_state_e state; int status = ml_pipeline_construct (pipeline, &handle); @@ -118,7 +118,7 @@ TEST (nnstreamer_capi_playstop, dummy_01) */ TEST (nnstreamer_capi_playstop, dummy_02) { - const char *pipeline = "videotestsrc is-live=true num-buffers=30 ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! valve name=valvey ! input-selector name=is01 ! tensor_sink name=sinkx"; + const char *pipeline = "videotestsrc is-live=true ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! valve name=valvey ! input-selector name=is01 ! tensor_sink name=sinkx"; ml_pipeline_h handle; ml_pipeline_state_e state; int status = ml_pipeline_construct (pipeline, &handle); @@ -174,7 +174,7 @@ TEST (nnstreamer_capi_valve, test01) gchar *file1 = g_build_path ("/", dir, "valve1", NULL); gchar *pipeline = g_strdup_printf - ("videotestsrc is-live=true num-buffers=20 ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=16,height=16,framerate=60/1 ! tensor_converter ! queue ! valve name=valve1 ! filesink location=\"%s\"", + ("videotestsrc is-live=true ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=16,height=16,framerate=60/1 ! tensor_converter ! queue ! valve name=valve1 ! filesink location=\"%s\"", file1); GStatBuf buf; @@ -190,10 +190,10 @@ TEST (nnstreamer_capi_valve, test01) status = ml_pipeline_valve_get_handle (handle, "valve1", &valve1); EXPECT_EQ (status, ML_ERROR_NONE); - status = ml_pipeline_start (handle); + status = ml_pipeline_valve_set_open (valve1, false); /* close */ EXPECT_EQ (status, ML_ERROR_NONE); - status = ml_pipeline_valve_set_open (valve1, false); /* close */ + status = ml_pipeline_start (handle); EXPECT_EQ (status, ML_ERROR_NONE); status = ml_pipeline_get_state (handle, &state); @@ -214,6 +214,7 @@ TEST (nnstreamer_capi_valve, test01) status = ml_pipeline_valve_set_open (valve1, true); /* open */ EXPECT_EQ (status, ML_ERROR_NONE); + status = ml_pipeline_valve_put_handle (valve1); /* release valve handle */ EXPECT_EQ (status, ML_ERROR_NONE); -- 2.7.4