[Transform/Stand] Change reaction for invalid option string
authorWook Song <wook16.song@samsung.com>
Tue, 12 Feb 2019 07:44:53 +0000 (16:44 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 15 Feb 2019 06:20:04 +0000 (15:20 +0900)
This patch changes the reaction for the invalid option string to
displaying error messages using g_critical and terminating the pipeline
before it starts.

Signed-off-by: Wook Song <wook16.song@samsung.com>
gst/nnstreamer/tensor_transform/tensor_transform.c

index d9d4fee..e3fccdb 100644 (file)
@@ -192,7 +192,8 @@ gst_tensor_transform_mode_get_type (void)
       {GTT_TRANSPOSE, "Mode for transposing shape of tensor, "
             "option=D1\':D2\':D3\':D4 (fixed to 3)",
           "transpose"},
-      {GTT_STAND, "Mode for statistical standardization of tensor",
+      {GTT_STAND, "Mode for statistical standardization of tensor, "
+            "option=default",
           "stand"},
       {GTT_UNKNOWN, "Unknown or not-implemented-yet mode",
           "unknown"},
@@ -891,7 +892,13 @@ gst_tensor_transform_set_option_data (GstTensorTransform * filter)
     {
       filter->data_stand.mode =
           gst_tensor_transform_get_stand_mode (filter->option);
-      g_assert (filter->data_stand.mode != STAND_END);
+      if (filter->data_stand.mode == STAND_END) {
+        g_critical ("%s: stand: "
+            "\'%s\' is not valid option string: "
+            "it should be \'default\', currently the only supported mode.\n",
+            gst_object_get_name ((GstObject *) filter), filter->option);
+        break;
+      }
       filter->loaded = TRUE;
       break;
     }