Issues converting code from C to C++. 'GST_IS_PAD (sinkpad)' failed

Hi, firstly, am very new to Deepstream so I would really appreciate any assistance with this matter. I have implemented a pipeline in C on my Xavier that takes in an rtsp feed and performs object detection. This pipeline worked perfectly in C.

However, when I converted it to C++ , I get the following error:

gst_pad_link_full: assertion ‘GST_IS_PAD (sinkpad)’ failed

According to error messages, the reason for this failure is GST_PAD_LINK_REFUSED.

Considering that the logic of the code did not change at all, I am very confused as to why sinkpad refuses to link to the streammux element.

• Jeston Xavier
• DeepStreamSDK 5.1.0
• Issue Type: bug

There is no clue in your description. The error is a very basic gstreamer core library error. So from the error, no one can know what is wrong with your code.

I know that the error occurs in the callback function “cb_newpad”, which is called here.
static GstElement *create_uridecode_bin (gint source_id, gchar * filename, gint * source_index, Feed feed)
{
GstElement *bin = NULL;
std::cout<<"creating uridecodebin for "<<filename<< “\n” << std::endl;
bin = gst_element_factory_make (“uridecodebin”, “test_feed_bin”);
g_object_set (G_OBJECT (bin), “uri”, filename, NULL);
g_signal_connect (G_OBJECT (bin), “pad-added”,G_CALLBACK (cb_newpad), source_index);
g_signal_connect (G_OBJECT (bin), “child-added”,G_CALLBACK (decodebin_child_added), source_index);
feed.set_source_enabled(true);
return bin;
}

The cb_newpad function is as follows:
static void

cb_newpad (GstElement * decodebin, GstPad * pad, gpointer data)
{
GstCaps *caps = gst_pad_query_caps (pad, NULL);
const GstStructure *str = gst_caps_get_structure (caps, 0);
const gchar *name = gst_structure_get_name (str);

if (!strncmp (name, “video”, 5)) {
std::cout<<“Source id feed_001\n” << std::endl;
GstPad sinkpad = NULL;
const gchar
pad_name = “pad_001”;
sinkpad = gst_element_get_request_pad (streammux, pad_name); //this is the line where the error occurs
if (gst_pad_link(pad, sinkpad) != GST_PAD_LINK_OK) {
std::cout<<“Failed to link decodebin to pipeline\n” << std::endl; //this is the error we get
}else {
std::cout<<“Decodebin linked to pipeline\n” << std::endl;
}
if (gst_pad_link(pad, sinkpad) == GST_PAD_LINK_WAS_LINKED) {
std::cout<<“Pads was already linked\n” << std::endl;
}
gst_object_unref (sinkpad);
}
}

The pipeline until this point is:

rtsp 0 → uridecodebin \ \

rtsp 1 → uridecodebin \ \ - → nvstreammux → …

Please run “gst-inspect-1.0 nvstreammux” command.

Can you find the following description?

Pad Templates:
  SINK template: 'sink_%u'
    Availability: On request
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)NV12, (string)RGBA, (string)I420 }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)NV12, (string)RGBA, (string)I420 }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                 format: { (string)NV12, (string)RGBA, (string)I420 }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]

nvstreammux sink pad is the request pad, the template is ‘sink_%u’, why don’t you follow it?

“pad_001” does not obey the template, it must fail.

Please make sure you are familiar with gstreamer knowledge and coding skills before you start with deepstream. It has nothing to do with deepstream or c/c++.

This is what I get when running that command:
Setting pipeline to PAUSED …
ERROR: Pipeline doesn’t want to pause.
ERROR: from element /GstPipeline:pipeline0/GstNvStreamMux:nvstreammux0: Output width not set
Additional debug info:
/dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvmultistream/gstnvstreammux.c(2512): gst_nvstreammux_change_state (): /GstPipeline:pipeline0/GstNvStreamMux:nvstreammux0
Setting pipeline to NULL …
Freeing pipeline …

Sorry for wrong command.

gst-inspect-1.0 nvstreammux

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.