Hi All,<div><br></div><div>I 'm struggling with full dublex rtp problem.</div><div><br></div><div>When I launch two separate pipeline (in same host) like below everything works just fine ( I can hear both sounds wave 5 and wave 1 and with wireshark I can see that rtp packets flows nicely in both directions):</div>
<div><br></div><div>Client A</div><div>------------</div><div>gst-launch-0.10 -v gstrtpbin name=rtpbin udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)16000,encoding-name=(string)SPEEX" port=5000 ! rtpbin.recv_rtp_sink_0 audiotestsrc wave=5 ! audioconvert ! audioresample ! audio/x-raw-int,rate=16000 ! queue leaky=1 ! speexenc bitrate=16000 ! rtpspeexpay ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! udpsink port=5002 sync=false async=false rtpbin. ! rtpspeexdepay ! queue leaky=1 ! speexdec ! audioconvert ! audioresample ! autoaudiosink </div>
<div><br></div><div><br></div><div>Client B</div><div>------------</div><div>gst-launch-0.10 -v gstrtpbin name=rtpbin udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)16000,encoding-name=(string)SPEEX" port=5002 ! rtpbin.recv_rtp_sink_0 audiotestsrc wave=1 ! audioconvert ! audioresample ! audio/x-raw-int,rate=16000 ! queue leaky=1 ! speexenc bitrate=16000 ! rtpspeexpay ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! udpsink port=5000 sync=false async=false rtpbin. ! rtpspeexdepay ! queue leaky=1 ! speexdec ! audioconvert ! audioresample ! autoaudiosink<br>
</div><div><br></div><div><br></div><div>But some reason version coded with Python doesn't work so well. I can hear only audio sent by one client not both.</div><div><br></div><div>Any idea what could be wrong in this Python code? Why both sounds cannot be heard?</div>
<div><br></div><div>client-b code is exactly same except port numbers and in 'def go()' line 'print autoaudiosink.set_locked_state(gst.STATE_PLAYING)' is not commented out (i don't know why it have to be like this?).</div>
<div><br></div><div><br></div><div>#!/usr/bin/env python</div><div># -=- encoding: utf-8 -=-</div><div><br></div><div>import gobject, pygst</div><div>pygst.require("0.10")</div><div>import gst</div><div>import gobject</div>
<div>import sys</div><div>import os</div><div>import readline</div><div><br></div><div># To the laptop that will catch everything</div><div>REMOTE_HOST = 'localhost' </div><div><br></div><div>caps = 'application/x-rtp,media=(string)audio,clock-rate=(int)16000,encoding-name=(string)SPEEX'</div>
<div><br></div><div>mainloop = gobject.MainLoop()</div><div>pipeline = gst.Pipeline('client-a')</div><div>bus = pipeline.get_bus()</div><div><br></div><div># incoming audio stream elements</div><div>rtpspeexdepay = gst.element_factory_make('rtpspeexdepay')</div>
<div>speexdec = gst.element_factory_make('speexdec')</div><div>audioconvert1 = gst.element_factory_make('audioconvert')</div><div>audioconvert2 = gst.element_factory_make('audioconvert')</div><div>
audioresample = gst.element_factory_make('audioresample')</div><div>autoaudiosink = gst.element_factory_make('autoaudiosink')</div><div>queue1 = gst.element_factory_make('queue')</div><div>#queue1.set_property('leaky', 1)</div>
<div><br></div><div># outgoing audio stream elements</div><div>audiotestsrc = gst.element_factory_make('audiotestsrc')</div><div>audiotestsrc.set_property('wave', 5)</div><div>audioconvert = gst.element_factory_make('audioconvert')</div>
<div>audioresample = gst.element_factory_make('audioresample')</div><div>speexenc = gst.element_factory_make('speexenc')</div><div>speexenc.set_property('bitrate', 16000)</div><div>rtpspeexpay = gst.element_factory_make('rtpspeexpay')</div>
<div>queue2 = gst.element_factory_make('queue')</div><div>#queue2.set_property('leaky', 1)</div><div><br></div><div># incoming rtp</div><div>udpsrc_rtpin = gst.element_factory_make('udpsrc', "udpsrc1")</div>
<div>udpsrc_rtpin.set_property('port', 5000)</div><div>udpsrc_caps = gst.caps_from_string(caps)</div><div>udpsrc_rtpin.set_property('caps', udpsrc_caps)</div><div><br></div><div># outgoing rtp</div><div>udpsink_rtpout = gst.element_factory_make("udpsink", "udpsink0")</div>
<div>udpsink_rtpout.set_property('host', REMOTE_HOST)</div><div>udpsink_rtpout.set_property('port', 5002)</div><div>udpsink_rtpout.set_property('sync', 'false')</div><div>udpsink_rtpout.set_property('async', 'false')</div>
<div><br></div><div># incoming and outgoing rtcp</div><div>#udpsink_rtcpout = gst.element_factory_make("udpsink", "udpsink1")</div><div>#udpsink_rtcpout.set_property('host', REMOTE_HOST)</div><div>
#udpsink_rtcpout.set_property('port', 5003)</div><div>#udpsink_rtcpout.set_property('sync', 'false')</div><div>#udpsink_rtcpout.set_property('async', 'false')</div><div>#udpsrc_rtcpin = gst.element_factory_make("udpsrc", "udpsrc0")</div>
<div>#udpsrc_rtcpin.set_property('port', 5007)</div><div><br></div><div>rtpbin = gst.element_factory_make('gstrtpbin', 'gstrtpbin')</div><div><br></div><div># Add elements</div><div>pipeline.add(rtpbin, udpsrc_rtpin, rtpspeexdepay, speexdec, audioconvert1, queue1, autoaudiosink, audiotestsrc, audioconvert2, audioresample, queue2, speexenc, rtpspeexpay, udpsink_rtpout)</div>
<div><br></div><div># Link them</div><div>udpsrc_rtpin.link_pads('src', rtpbin, 'recv_rtp_sink_0')</div><div><br></div><div>def rtpbin_pad_added(obj, pad):</div><div> print "PAD ADDED"</div><div>
print " obj = ", obj</div><div> print " pad = ", pad</div><div> print " pad capabilities = ", str(pad.get_property('caps'))</div><div> rtpbin.link(rtpspeexdepay)</div>
<div><br></div><div>rtpspeexdepay.link(queue1) </div><div>queue1.link(speexdec)</div><div>speexdec.link(audioconvert1)</div><div>audioconvert1.link(autoaudiosink)</div><div><br></div><div>audiotestsrc.link(audioconvert2)</div>
<div>audioconvert2.link(audioresample)</div><div>audio_caps = gst.Caps("audio/x-raw-int,rate=16000")</div><div>audioresample.link_filtered(queue2, audio_caps)</div><div>queue2.link(speexenc)</div><div>speexenc.link(rtpspeexpay)</div>
<div><br></div><div>rtpspeexpay.link_pads('src', rtpbin, 'send_rtp_sink_0')</div><div>rtpbin.link_pads('send_rtp_src_0', udpsink_rtpout, 'sink')</div><div><br></div><div>rtpbin.connect('pad-added', rtpbin_pad_added)</div>
<div><br></div><div>def go():</div><div> #print "Setting locked state for autovideosink and udpsink"</div><div> #print udpsink_rtcpout.set_locked_state(gst.STATE_PLAYING)</div><div> #print autoaudiosink.set_locked_state(gst.STATE_PLAYING) </div>
<div> print "Setting pipeline to PLAYING"</div><div> print pipeline.set_state(gst.STATE_PLAYING)</div><div> print "Waiting pipeline to settle"</div><div> print pipeline.get_state()</div><div>
#print "Final caps writte to", WRITE_AUDIO_CAPS</div><div> #open(WRITE_AUDIO_CAPS, 'w').write(str(udpsink_rtpout.get_pad('sink').get_property('caps')))</div><div> print "audio stream caps = ", str(udpsink_rtpout.get_pad('sink').get_property('caps'))</div>
<div> mainloop.run()</div><div><br></div><div>go()</div><div> </div><div><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Thanks in advance!</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Thanks & Regards,
Tommi Roth</pre></div>