[C-Api] remove unnecessary local value
authorJaeyun <jy1210.jung@samsung.com>
Wed, 3 Jul 2019 09:04:37 +0000 (18:04 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 8 Jul 2019 10:22:29 +0000 (19:22 +0900)
1. remove unnecessary local variable in pipe api
2. remove unnecessary buffer count in testcases

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
api/capi/src/nnstreamer-capi-pipeline.c
tests/tizen_capi/unittest_tizen_capi.cpp

index a0aea1e..ec963de 100644 (file)
@@ -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)
index 1b58a70..22f103a 100644 (file)
@@ -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);