GST: Not linking elements correctly

Hey so I’m having another problem with my OpenMic library + program. This time its related to linking elements. I currently get this error with the openmic-cli program:

(openmic-cli:1745567): GStreamer-WARNING **: 09:46:25.957: Trying to link elements autoaudiosrc0 and autoaudiosink0 that don't share a common ancestor: autoaudiosink0 hasn't been added to a bin or pipeline, and autoaudiosrc0 is in autoaudiosink0
(openmic-cli:1745567): GStreamer-WARNING **: 09:46:25.957: Trying to link elements autoaudiosrc0 and autoaudiosink0 that don't share a common ancestor: autoaudiosink0 hasn't been added to a bin or pipeline, and autoaudiosrc0 is in autoaudiosink0
** (openmic-cli:1745567): ERROR **: 09:46:26.030: OpenMicContext: Internal data stream error.

zsh: trace trap (core dumped) ./build/openmic-cli

I’m expecting this to be entirely related to linking the nodes as when I link them with “gst_element_link” in “openmic_node_attach”, the program segfaults. I’m not quite sure as how this should be done so I’d like some tips or suggestions or whatever is needed to get my code to work. As this is related to the OpenMicNode source code, I’ll link only the code for that but the rest of the code is viewable if needed.

This error happens because you do

	gst_bin_add(GST_BIN(priv->elem), other_priv->elem);
	gst_element_link(other_priv->elem, priv->elem);

other_priv->elem and priv->elem need to be inside the same bin at the same level, otherwise you can’t link them together.

If you want to link an element inside the bin somehow with a pad of the bin you need to use GhostPads.

1 Like

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