<div style="font-family: arial; font-size: 14px;"><div style="font-family: arial; font-size: 14px;">Hello,<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">I am writing an application where I dynamically add many branches to the adder element. In each branch I wait for the first buffer on the src pad using pad probes. When that happens I try to link branch's bin to the adder. That means that bin.link(adder) is being called from multiple streaming threads in parallel.  The problem is that when linking is being called from the streaming threads, it seems that adder is confused when it comes to the pads. It tries to link the same pad multiple times with different branches and finally reports an error which suggests a bug.<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">Moreover, sometimes pipeline is automatically changing state to PAUSED and never goes back to PLAYING, even if I set state.<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">If I do this in the main thread, the error dissapears but still it still sometimes stays in PAUSED.<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">1. Is that safe to link adder's branches dynamically from the streaming thread should I do this in the main thread?<br></div><div style="font-family: arial; font-size: 14px;">2. What are the conditions under which the pipeline can automatically go and stay stuck in PAUSED? I add only sources, not sinks.<br></div><div style="font-family: arial; font-size: 14px;">3. Does the warning below really indicate a bug or am I doing something incorrectly?<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">This is definitely sort of race condition, if I add exactly the same branches but slowly everything works fine.<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">Logs:<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636019000  5427 0x7f850c06b800 INFO               structure gststructure.c:2842:gst_structure_get_valist: Expected field 'channel-mask' in structure: audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ];<br></div><div>0:00:15.636026000  5427 0x7f850c06b240 INFO        GST_ELEMENT_PADS gstutils.c:1819:gst_element_link_pads_full: trying to link element stream3:(any) to element adder:(any)<br></div><div>0:00:15.636018000  5427 0x7f850c062b00 INFO        GST_ELEMENT_PADS gstutils.c:1819:gst_element_link_pads_full: trying to link element stream:(any) to element adder:(any)<br></div><div>0:00:15.636189000  5427 0x7f850c06b240 INFO               structure gststructure.c:2842:gst_structure_get_valist: Expected field 'channel-mask' in structure: audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ];<br></div><div>0:00:15.636219000  5427 0x7f850c06b800 INFO                GST_PADS gstutils.c:1633:prepare_link_maybe_ghosting: stream4 and adder in same bin, no need for ghost pads<br></div></div><div style="font-family: arial; font-size: 14px;">0:00:15.636225000  5427 0x7f850c062b00 INFO               structure gststructure.c:2842:gst_structure_get_valist: Expected field 'channel-mask' in structure: audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ];<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636236000  5427 0x7f850c06b800 INFO                GST_PADS gstpad.c:2383:gst_pad_link_prepare: trying to link stream4:src and adder:sink_5<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636270000  5427 0x7f850c06b240 INFO        GST_ELEMENT_PADS gstelement.c:753:gst_element_add_pad:<adder> adding pad 'sink_6'<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636362000  5427 0x7f850c06b800 INFO                GST_PADS gstpad.c:2423:gst_pad_link_prepare: sink adder:sink_5 was already linked to stream2:src<br></div><div style="font-family: arial; font-size: 14px;"><b>0:00:15.636067000  5427 0x7f850c06b0c0 INFO                GST_PADS gstpad.c:2591:gst_pad_link_full: linked stream2:src and adder:sink_5, successful</b><b><br></b></div><div style="font-family: arial; font-size: 14px;">0:00:15.636382000  5427 0x7f850c06b0c0 INFO               GST_EVENT gstevent.c:1610:gst_event_new_reconfigure: creating reconfigure event<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636431000  5427 0x7f850c06b240 INFO                GST_PADS gstutils.c:1633:prepare_link_maybe_ghosting: stream3 and adder in same bin, no need for ghost pads<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636446000  5427 0x7f850c06b240 INFO                GST_PADS gstpad.c:2383:gst_pad_link_prepare: trying to link stream3:src and adder:sink_6<br></div><div style="font-family: arial; font-size: 14px;"><b>0:00:15.636451000  5427 0x7f850c06b800 INFO                GST_PADS gstpad.c:2534:gst_pad_link_full: link between stream4:src and adder:sink_5 failed: was linked</b><b><br></b></div><div style="font-family: arial; font-size: 14px;">0:00:15.636366000  5427 0x7f850c062b00 INFO        GST_ELEMENT_PADS gstelement.c:753:gst_element_add_pad:<adder> adding pad 'sink_7'<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636493000  5427 0x7f850c06b240 INFO               structure gststructure.c:2842:gst_structure_get_valist: Expected field 'channel-mask' in structure: audio/x-raw, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ];<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636501000  5427 0x7f850a05aaa0 INFO           basetransform gstbasetransform.c:1325:gst_base_transform_setcaps:<converter> reuse caps<br></div><div style="font-family: arial; font-size: 14px;"><b>0:00:15.636479000  5427 0x7f850c06b800 INFO        GST_ELEMENT_PADS gstelement.c:869:gst_element_remove_pad:<adder> removing pad 'sink_5'</b><b><br></b></div><div style="font-family: arial; font-size: 14px;">0:00:15.636605000  5427 0x7f85090e5400 INFO            audiodecoder gstaudiodecoder.c:2522:gst_audio_decoder_sink_eventfunc:<atdec7> upstream stream tags: taglist, organization=(string)"no\ name", has-crc=(boolean)false, channel-mode=(string)joint-stereo, audio-codec=(string)"MPEG-1\ Layer\ 3\ \(MP3\)", nominal-bitrate=(uint)192000, minimum-bitrate=(uint)191712, maximum-bitrate=(uint)191712, bitrate=(uint)191988;<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636655000  5427 0x7f850c06b800 INFO        GST_ELEMENT_PADS gstpad.c:2139:gst_pad_unlink: unlinking stream2:src(0x7f850c060ef0) and adder:sink_5(0x7f850c88db00)<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636695000  5427 0x7f850a05aaa0 INFO            audiodecoder gstaudiodecoder.c:2522:gst_audio_decoder_sink_eventfunc:<atdec4> upstream stream tags: taglist, organization=(string)"no\ name", has-crc=(boolean)false, channel-mode=(string)joint-stereo, audio-codec=(string)"MPEG-1\ Layer\ 3\ \(MP3\)", nominal-bitrate=(uint)192000, minimum-bitrate=(uint)191712, maximum-bitrate=(uint)191712, bitrate=(uint)191988;<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636781000  5427 0x7f850a05ab00 INFO            audiodecoder gstaudiodecoder.c:2522:gst_audio_decoder_sink_eventfunc:<atdec6> upstream stream tags: taglist, organization=(string)"no\ name", has-crc=(boolean)false, channel-mode=(string)joint-stereo, audio-codec=(string)"MPEG-1\ Layer\ 3\ \(MP3\)", nominal-bitrate=(uint)192000, minimum-bitrate=(uint)191712, maximum-bitrate=(uint)191712, bitrate=(uint)191988;<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636850000  5427 0x7f85090e5400 INFO            audiodecoder gstaudiodecoder.c:2522:gst_audio_decoder_sink_eventfunc:<atdec7> upstream stream tags: taglist, organization=(string)"no\ name", has-crc=(boolean)false, channel-mode=(string)joint-stereo, audio-codec=(string)"MPEG-1\ Layer\ 3\ \(MP3\)", nominal-bitrate=(uint)192000, minimum-bitrate=(uint)191712, maximum-bitrate=(uint)192018, bitrate=(uint)191990;<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636951000  5427 0x7f850a05ab60 INFO            audiodecoder gstaudiodecoder.c:2522:gst_audio_decoder_sink_eventfunc:<atdec5> upstream stream tags: taglist, organization=(string)"no\ name", has-crc=(boolean)false, channel-mode=(string)joint-stereo, audio-codec=(string)"MPEG-1\ Layer\ 3\ \(MP3\)", nominal-bitrate=(uint)192000, minimum-bitrate=(uint)191712, maximum-bitrate=(uint)191712, bitrate=(uint)191988;<br></div><div style="font-family: arial; font-size: 14px;">0:00:15.636957000  5427 0x7f850a05ab00 INFO            audiodecoder gstaudiodecoder.c:2522:gst_audio_decoder_sink_eventfunc:<atdec6> upstream stream tags: taglist, organization=(string)"no\ name", has-crc=(boolean)false, channel-mode=(string)joint-stereo, audio-codec=(string)"MPEG-1\ Layer\ 3\ \(MP3\)", nominal-bitrate=(uint)192000, minimum-bitrate=(uint)191712, maximum-bitrate=(uint)192018, bitrate=(uint)191990;<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;"><b>(radiokit-stream:5427): GStreamer-WARNING **: 16:00:49.856: pad adder:sink_5 has no event handler, file a bug.</b><b><br></b></div><div style="font-family: arial; font-size: 14px;"><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">Using 1.18.5 on Mac OS X.<br></div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">Thanks,</div><div style="font-family: arial; font-size: 14px;"><br></div><div style="font-family: arial; font-size: 14px;">Marcin</div><div><br></div></div><div style="font-family: arial; font-size: 14px;"><br></div>