/* finally set pipeline state to PAUSED */
if (status == ML_ERROR_NONE) {
status = ml_pipeline_stop ((ml_pipeline_h) pipe_h);
+
+ if (status == ML_ERROR_NONE) {
+ /**
+ * Let's wait until the pipeline state is changed to paused.
+ * Otherwise, the following APIs like 'set_property' may incur
+ * unintended behaviors. But, don't need to return any error
+ * even if this state change is not finished within the timeout,
+ * just replying on the caller.
+ */
+ gst_element_get_state (pipeline, NULL, NULL, 10 * GST_MSECOND);
+ }
}
failed:
gchar *name;
GstEvent *event;
gchar *stream_id;
- GstCaps *caps;
+ GstCaps *caps = NULL;
walk = tensor_demux->srcpads;
while (walk) {
if (num == 1 && gst_pad_has_tensor_caps (pad)) {
GstTensorConfig config;
gint64 idx = g_ascii_strtoll (strv[0], NULL, 10);
- gst_tensor_demux_get_tensor_config (tensor_demux, &config, idx);
- caps = gst_tensor_caps_from_config (&config);
+ if (gst_tensor_demux_get_tensor_config (tensor_demux, &config, idx))
+ caps = gst_tensor_caps_from_config (&config);
} else {
GstTensorsConfig config;
guint i;
g_strfreev (strv);
} else {
GstTensorConfig config;
- gst_tensor_demux_get_tensor_config (tensor_demux, &config, nth);
- caps = gst_tensor_caps_from_config (&config);
+ if (gst_tensor_demux_get_tensor_config (tensor_demux, &config, nth))
+ caps = gst_tensor_caps_from_config (&config);
}
- gst_pad_set_caps (pad, caps);
- gst_caps_unref (caps);
+ if (caps) {
+ gst_pad_set_caps (pad, caps);
+ gst_caps_unref (caps);
+ } else {
+ GST_WARNING_OBJECT (tensor_demux, "Unable to set pad caps");
+ }
if (created) {
*created = TRUE;