Replacing udpsrc with appsrc in Gstreamer pipe

45 Views Asked by At

I have built the following pipeline working fine with Python:

Gst.parse_launch('udpsrc address=127.0.0.1 port=5000 caps="application/x-rtp" ! queue ! rtppcmudepay ! queue ! autoaudiosink')

I send it rtp packets via udp and hear sound coming out. I'd like to remove the extra hop of udp and pass rtp packets to gstreamer via a function call. Graph: here

I tried:

source = Gst.ElementFactory.make("appsrc", "mysrc")
bin = Gst.parse_launch(f'appsrc caps=application/x-rtp name=mysrc  ! queue  ! rtppcmudepay ! queue ! autoaudiosink')

and feeding it packets using source.emit('push-buffer', Gst.Buffer.new_wrapped(buf)). No error is reported but neither do I hear any sound. The graph is different for some reason, namely with udpsrc I see the clockrate at every step of the graph, while with appsrc its missing from one and seen twice on another, the clockrate isn't seen anywhere, and the whole thing seems to be on pause ("="), despite me calling source.set_state(Gst.State.PLAYING) and bin_.set_state(Gst.State.PLAYING)

graph

0

There are 0 best solutions below