[Telepathy] gst.LinkError in Telepathy Farsight

Mystilleef mystilleef at gmail.com
Fri Jun 17 15:04:37 PDT 2011


Thanks for your response Tiago.

On Fri, Jun 17, 2011 at 5:51 PM, Tiago Katcipis <katcipis at inf.ufsc.br> wrote:
> Hi,
>
> On Fri, Jun 17, 2011 at 9:54 AM, Mystilleef <mystilleef at gmail.com> wrote:
>>
>> I'm getting the following error with tp-farsight
>>
>> =========================================================================
>> Traceback (most recent call last):
>>  File "/home/lateef/teletest/MediaChannelStreamer.py", line 54, in
>> __stream_created_cb
>>    src.get_pad("src").link(srcpad)
>> gst.LinkError: <enum GST_PAD_LINK_WRONG_HIERARCHY of type
>> GstPadLinkReturn>
>
> I think this happens because you are trying to link two pads and the
> elements that owns the pads are not inside the same pipeline (the same bin
> to me more exact).
>
>>
>> =========================================================================
>>
>> The code in question:
>>
>> ========================================================================
>>        def __stream_created_cb(self, channel, stream):
>>                print "Start of stream created!"
>>                stream.connect("src-pad-added", self.__src_pad_added_cb)
>>                srcpad = stream.get_property ("sink-pad")
>>                from gst import element_factory_make, STATE_PLAYING
>>                src = element_factory_make("audiotestsrc")
>>                src.get_pad("src").link(srcpad)
>>                src.set_property("is-live", True)
>>                src.set_state(STATE_PLAYING)
>>                self.__pipeline.add(src)
>
> here it seems to be the problem, self.__pipeline.add(src) and
> src.set_state(STATE_PLAYING) should be called before you call
> src.get_pad("src").link(srcpad). You can link pads of elements that belong
> to the same pipeline (bin) and are on the same state.
>


I think you're right. I also had to set "STATE_PLAYING" in an idle handler.


	def __stream_created_cb(self, channel, stream):
		stream.connect("src-pad-added", self.__src_pad_added_cb)
		from gst import element_factory_make, STATE_PLAYING
		src = element_factory_make("autoaudiosrc")
		self.__pipeline.add(src)
		srcpad = stream.get_property ("sink-pad")
		src.get_pad("src").link(srcpad)
		from gi.repository.GObject import idle_add
		idle_add(src.set_state, STATE_PLAYING)
		return False


This fixed it for me.

>>
>>                print "End of stream created!"
>>                return False
>>
>>        def __src_pad_added_cb(self, stream, pad, codec):
>>                print "Start of __src_pad_added_cb"
>>                from gst import STATE_PLAYING, parse_bin_from_description
>>                sink = parse_bin_from_description("audioconvert !
>> audioresample !
>> audioconvert ! autoaudiosink", True)
>>                pad.link(sink.get_pad("sink"))
>>                sink.set_state(STATE_PLAYING)
>>                self.__pipeline.add(sink)
>
> Same problem here.
>
>>
>>                print "End of __src_pad_added_cb"
>>                return False
>>
>>        def __session_created_cb(self, channel, conference, participant):
>>                print "Start of __session_created_cb"
>>                self.__pipeline.add(conference)
>>                from gst import STATE_PLAYING
>>                self.__pipeline.set_state(STATE_PLAYING)
>>                print "End of __session_created_cb"
>>                return False
>>

I think calling the states in an idle handler also helps, but I didn't
need to do
that in the pad added callback.

Thanks for your help.


More information about the telepathy mailing list