<div dir="ltr">Hello,<div><br></div><div>I am trying to link a depayer and a decoder to an rtpbin when a pad is added (new stream).</div><div>It does not seem to work, no errors, just does not play.</div><div><br></div><div>The prototype pipeline is:</div><div><div>gst-launch-1.0 -v audiomixer name=mix ! audioconvert ! alsasink rtpbin name=bin udpsrc address=ipHere port=portHere caps="application/x-rtp,media=audio,clock-rate=8000" ! bin.recv_rtp_sink_0 bin. ! rtppcmudepay ! mulawdec ! mix.</div></div><div><br></div><div>This works without issue, however after one stream it no longer works. I can keep adding "<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">bin. ! rtppcmudepay ! mulawdec ! mix." a thousand times, but the real solution is for the elements to be created and destroyed as needed.</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I have not gotten round to handling the destroyed part at all yet. Do I need to? Or will gstreamer delete elements as they are no longer used?</span></div><div><br></div><div>Any help would be appreciated.</div><div><br></div><div>Thanks.</div><div><br clear="all"><div>Here is the relevant code:</div></div><div><pre style="color:rgb(0,0,0);text-decoration-style:initial;text-decoration-color:initial"> <span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">def</span> <span class="gmail-nf" style="color:rgb(0,160,0)">request_decoder</span><span class="gmail-p">(</span><span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-p">,</span> <span class="gmail-n">element</span><span class="gmail-p">,</span> <span class="gmail-n">pad</span><span class="gmail-p">):</span>
<span class="gmail-n">depay</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">ElementFactory</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">make</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">"rtppcmudepay"</span><span class="gmail-p">)</span>
<span class="gmail-n">decode</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">ElementFactory</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">make</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">"mulawdec"</span><span class="gmail-p">)</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">add</span><span class="gmail-p">(</span><span class="gmail-n">depay</span><span class="gmail-p">,</span> <span class="gmail-n">decode</span><span class="gmail-p">)</span>
<span class="gmail-n">pad</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">link</span><span class="gmail-p">(</span><span class="gmail-n">depay</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">get_static_pad</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">"sink"</span><span class="gmail-p">))</span>
<span class="gmail-n">depay</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">link</span><span class="gmail-p">(</span><span class="gmail-n">decode</span><span class="gmail-p">)</span>
<span class="gmail-n">decode</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">link</span><span class="gmail-p">(</span><span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">mixpad</span><span class="gmail-p">)</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">def</span> <span class="gmail-nf" style="color:rgb(0,160,0)">startAudio</span><span class="gmail-p">(</span><span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-p">):</span>
<span class="gmail-n">logger</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">info</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">"setting up audio reception @ {}:{}"</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">format</span><span class="gmail-p">(</span><span class="gmail-n">multicast</span><span class="gmail-p">,</span> <span class="gmail-n">port</span><span class="gmail-p">))</span>
<span class="gmail-n">pipestring</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-s" style="color:rgb(187,68,68)">"audiomixer name=mix ! audioconvert ! alsasink rtpbin name=bin udpsrc name=src ! bin.recv_rtp_sink_0"</span>
<span class="gmail-n">logger</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">info</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">"PipeLine: "</span><span class="gmail-o" style="color:rgb(102,102,102)">+</span><span class="gmail-n">pipestring</span><span class="gmail-p">)</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">parse_launch</span><span class="gmail-p">(</span><span class="gmail-n">pipestring</span><span class="gmail-p">)</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">srcpad</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">get_by_name</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">'src'</span><span class="gmail-p">)</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">binpad</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">get_by_name</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">'bin'</span><span class="gmail-p">)</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">mixpad</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">get_by_name</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">'mix'</span><span class="gmail-p">)</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">srcpad</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">props</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">address</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-n">multicast</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">srcpad</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">props</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">port</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-n">port</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">srcpad</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">props</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">caps</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">Caps</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">from_string</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">'application/x-rtp,media=audio,clock-rate=8000'</span><span class="gmail-p">)</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">binpad</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">connect</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">'pad_added'</span><span class="gmail-p">,</span> <span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">request_decoder</span><span class="gmail-p">)</span>
<span class="gmail-n">ret</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">set_state</span><span class="gmail-p">(</span><span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">State</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">PLAYING</span><span class="gmail-p">)</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">if</span> <span class="gmail-n">ret</span> <span class="gmail-o" style="color:rgb(102,102,102)">==</span> <span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">StateChangeReturn</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">FAILURE</span><span class="gmail-p">:</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">raise</span> <span class="gmail-ne" style="color:rgb(210,65,58);font-weight:bold">Exception</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">"Unable to start udp source!"</span><span class="gmail-p">)</span>
<span class="gmail-n">logger</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">info</span><span class="gmail-p">(</span><span class="gmail-s" style="color:rgb(187,68,68)">"ready to receive audio"</span><span class="gmail-p">)</span>
<span class="gmail-n">bus</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">get_bus</span><span class="gmail-p">()</span>
<span class="gmail-n">bus</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">add_signal_watch</span><span class="gmail-p">()</span>
<span class="gmail-n">terminate</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">False</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">while</span> <span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">True</span><span class="gmail-p">:</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">try</span><span class="gmail-p">:</span>
<span class="gmail-n">msg</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-n">bus</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">timed_pop_filtered</span><span class="gmail-p">(</span>
<span class="gmail-mf" style="color:rgb(102,102,102)">0.5</span> <span class="gmail-o" style="color:rgb(102,102,102)">*</span> <span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">SECOND</span><span class="gmail-p">,</span>
<span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">MessageType</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">ERROR</span> <span class="gmail-o" style="color:rgb(102,102,102)">|</span> <span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">MessageType</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">EOS</span><span class="gmail-p">)</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">if</span> <span class="gmail-n">msg</span><span class="gmail-p">:</span>
<span class="gmail-n">terminate</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">True</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">except</span> <span class="gmail-ne" style="color:rgb(210,65,58);font-weight:bold">KeyboardInterrupt</span><span class="gmail-p">:</span>
<span class="gmail-n">terminate</span> <span class="gmail-o" style="color:rgb(102,102,102)">=</span> <span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">True</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">if</span> <span class="gmail-n">terminate</span><span class="gmail-p">:</span>
<span class="gmail-k" style="color:rgb(170,34,255);font-weight:bold">break</span>
<span class="gmail-bp" style="color:rgb(170,34,255)">self</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">pipeline</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">set_state</span><span class="gmail-p">(</span><span class="gmail-n">Gst</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">State</span><span class="gmail-o" style="color:rgb(102,102,102)">.</span><span class="gmail-n">NULL</span><span class="gmail-p">)</span></pre></div></div>
<br>
<div><font face="Arial, Helvetica, sans-serif" size="1">Este correo electrónico y cualquier archivo transmitido adjunto son confidenciales y destinados exclusivamente para el uso de la persona o entidad a quien se dirigen. Si usted ha recibido este mensaje por error por favor notifique al administrador del sistema.</font></div><div><font size="1"><font face="Arial, Helvetica, sans-serif"><b>Aviso de Privacidad</b>: </font><span style="font-family:Arial,Helvetica,sans-serif">La empresa Mathieson Electrónica en Comunicación S.A. De C.V. con domicilio ubicado en, Geranios #76, Jardines de San Mateo, Naucalpan, Estado de Mexico, C.P. 53240. utilizara sus datos personales recabados con los siguientes fines: Fines laborales. para mayor información sobre el tratamiento de sus datos personales usted puede ingresar a la siguiente página web: <a href="http://privacy.mathiesonelco.com" target="_blank">http://privacy.mathiesonelco.<wbr>com/</a></span></font></div><div><font face="Arial, Helvetica, sans-serif" size="1">Mathieson Electronica en Comunicación S.A. de C.V.</font></div>