I followed dynamic adding new source during the run time. I am facing one issue. Below are the steps I followed:
- First create config.txt and it has RTSP source, primary-gie,secondary-gie and file sink.
- I ran the Deepstream and it works fine with file sink data
- I put the source (appCtx[0]->pipeline.multi_src_bin.sub_bins[0].bin) in PAUSED mode. FILE sink stopped to generate data
- By using dynamic adding source code I added new source during the run time
- New source (appCtx[0]->pipeline.multi_src_bin.sub_bins[1].bin) set as either PLAYING or PAUSED state
- RTSP source always going to PLAYING state.
- Expected result should be PAUSED
Any help will be appreciated.
I followed below source code for adding source during the run time:
gboolean
add_sources (gchar* new_camera_addr,guint source_id)
{
NvDsPipeline *pipeline = &appCtx[0]->pipeline;
GstStateChangeReturn state_return;
NvDsConfig *config=&appCtx[0]->config;
guint i;
parse_dir_source(&appCtx[0]->config,new_camera_addr,source_id);
if(!create_source_bin (&appCtx[0]->config.multi_source_config[source_id], &appCtx[0]->pipeline.multi_src_bin.sub_bins[source_id],source_id)){
g_print(“Failed to Create the New source_bin”);
return FALSE;
}
gst_bin_add (GST_BIN (appCtx[0]->pipeline.multi_src_bin.bin),appCtx[0]->pipeline.multi_src_bin.sub_bins[source_id].bin);
if (!link_element_to_streammux_sink_pad (appCtx[0]->pipeline.multi_src_bin.streammux,
appCtx[0]->pipeline.multi_src_bin.sub_bins[source_id].bin,source_id)) {
g_print(“Cannot Link With Streammux”);
}
appCtx[0]->pipeline.multi_src_bin.num_bins++;
state_return =
gst_element_set_state (appCtx[0]->pipeline.multi_src_bin.sub_bins[source_id].bin, GST_STATE_PLAYING);
switch (state_return) {
case GST_STATE_CHANGE_SUCCESS:
g_print (“STATE CHANGE SUCCESS\n\n”);
return TRUE;
break;
case GST_STATE_CHANGE_FAILURE:
g_print (“STATE CHANGE FAILURE\n\n”);
return FALSE;
break;
case GST_STATE_CHANGE_ASYNC:
g_print (“STATE CHANGE ASYNC\n\n”);
state_return =
gst_element_get_state (appCtx[0]->pipeline.multi_src_bin.sub_bins[source_id].bin, NULL, NULL,
GST_CLOCK_TIME_NONE);
return TRUE;
break;
case GST_STATE_CHANGE_NO_PREROLL:
g_print (“STATE CHANGE NO PREROLL\n\n”);
break;
default:
break;
}
return TRUE;
}