<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I'm trying to refactor some working sample code which is using this pattern:<div class=""><br class=""></div><div class="">- A webrtcbin pipeline is created from string</div><div class="">- The "on_negotiation_needed" callback triggers the OFFER creation.</div><div class=""><br class=""></div><div class="">Basically this is the Python code, which appears in many forms on the Internet and is originated from one of the GStreamer sample codes:</div><div class=""><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><span style="color: #00950e;font-style: italic;" class=""><br class=""></span></div><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><div style="line-height: 21px;" class=""><div class=""><span style="color: #006078;" class="">PIPELINE_TEST_VP8</span> <span style="color: #7f0055;" class="">=</span> '''</div><div class="">webrtcbin name=webrtcbin bundle-policy=max-bundle stun-server=<a href="stun://stun.l.google.com:19302" class="">stun://stun.l.google.com:19302</a></div><div class="">videotestsrc is-live=true pattern=ball ! videoconvert ! queue ! vp8enc deadline=1 ! queue ! rtpvp8pay !</div><div class="">queue ! application/x-rtp,media=video,encoding-name=VP8 ! webrtcbin.</div><div class="">'''</div><br class=""></div></div></div><div class=""><br class=""></div><div class=""><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><div class="">    <span style="color: #210de5;font-weight: bold;" class="">def</span> <span style="color: #1200bb;" class="">start_pipeline</span>(<span style="color: #ab3c11;font-style: italic;" class="">self</span>):</div><div class="">        <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">pipe</span> <span style="color: rgb(127, 0, 85);" class="">=</span> Gst.parse_launch(<span style="color: rgb(0, 96, 120);" class="">PIPELINE_TEST_VP8</span>)</div><div class="">        <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">webrtcbin</span> <span style="color: rgb(127, 0, 85);" class="">=</span> <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">pipe</span>.get_by_name(<span style="color: rgb(209, 38, 209);" class="">'webrtcbin'</span>)</div><div style="line-height: 21px;" class=""><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">if</span> Gst.version().<span style="color: #265cd1;" class="">major</span> <span style="color: #7f0055;font-weight: bold;" class="">>=</span> <span style="color: #ff8000;" class="">1</span> <span style="color: #7f0055;" class="">and</span> Gst.version().<span style="color: #265cd1;" class="">minor</span> <span style="color: #7f0055;font-weight: bold;" class="">>=</span> <span style="color: #ff8000;" class="">17</span>:</div><div class="">            trans <span style="color: #7f0055;" class="">=</span> <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.emit(<span style="color: #d126d1;" class="">'get-transceiver'</span>, <span style="color: #ff8000;" class="">0</span>)</div><div class="">            <span style="color: #7f0055;font-weight: bold;" class="">if</span> <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">direction</span> <span style="color: #7f0055;font-weight: bold;" class="">==</span> <span style="color: #d126d1;" class="">'sendonly'</span>:</div><div class="">                trans.set_property(<span style="color: #d126d1;" class="">'direction'</span>, GstWebRTC.<span style="color: #265cd1;" class="">WebRTCRTPTransceiverDirection</span>.<span style="color: #006078;" class="">SENDONLY</span>)</div><div class="">            <span style="color: #7f0055;font-weight: bold;" class="">elif</span> <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">direction</span> <span style="color: #7f0055;font-weight: bold;" class="">==</span> <span style="color: #d126d1;" class="">'recvonly'</span>:</div><div class="">                trans.set_property(<span style="color: #d126d1;" class="">'direction'</span>, GstWebRTC.<span style="color: #265cd1;" class="">WebRTCRTPTransceiverDirection</span>.<span style="color: #006078;" class="">RECVONLY</span>)</div><div class="">            <span style="color: #7f0055;font-weight: bold;" class="">else</span>:</div><div class="">                trans.set_property(<span style="color: #d126d1;" class="">'direction'</span>, GstWebRTC.<span style="color: #265cd1;" class="">WebRTCRTPTransceiverDirection</span>.<span style="color: #006078;" class="">SENDRECV</span>)</div><div class=""></div></div><div class="">        <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">webrtcbin</span>.connect(<span style="color: rgb(209, 38, 209);" class="">'on-negotiation-needed'</span>, <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">on_negotiation_needed</span>) </div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'on-ice-candidate'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_ice_candidate</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'pad-added'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_pad_added</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::connection-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_connection_state</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::signaling-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_signaling_state</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::ice-connection-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_ice_connection_state</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::ice-gathering-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_ice_gathering_state</span>)</div><div class="">        <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">pipe</span>.set_state(Gst.<span style="color: rgb(38, 92, 209);" class="">State</span>.<span style="color: rgb(0, 96, 120);" class="">PLAYING</span>)</div><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div>The offer looks good and is answered correctly, video flows.</div></div><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div><div style="background-color: rgb(255, 255, 255); line-height: 21px;" class=""><font face="Fira Code, Menlo, Monaco, Courier New, monospace, Menlo, Monaco, Courier New, monospace" class=""><span style="white-space: pre;" class="">v=0
o=- 7638256982687930899 0 IN IP4 0.0.0.0
s=-
t=0 0
a=ice-options:trickle
a=group:BUNDLE video0
m=video 9 UDP/TLS/RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=setup:actpass
a=ice-ufrag:bGQItiwLYlgcID/WCvvmBOvCOn7T5c/I
a=ice-pwd:7XItJ6VJFOoh8jcwd4Rvq34OW1/KYRSD
a=rtcp-mux
a=rtcp-rsize
a=sendrecv
a=rtpmap:96 H264/90000
a=rtcp-fb:96 nack pli
a=framerate:30
a=fmtp:96 packetization-mode=1;profile-level-id=42c01e;sprop-parameter-sets=Z0LAHtkAoD2wFqDAwNSgAAADACAAAAeR4sXJ,aMuMsg==
a=ssrc:480748954 msid:user4125901687@host-1eadd0cf webrtctransceiver0
a=ssrc:480748954 cname:user4125901687@host-1eadd0cf
a=mid:video0
a=fingerprint:sha-256 54:82:06:0C:5D:7C:47:63:C2:1A:8D:D0:CC:0E:9D:20:47:A8:6C:B0:CF:31:74:0D:E2:5F:D6:D9:F5:21:D5:94</span></font><span style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; white-space: pre;" class="">
</span></div><div class=""><br class=""></div><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div><div style="background-color: rgb(255, 255, 255); line-height: 21px;" class="">Because this approach of a pre-canned pipeline seems to have difficulties in a mode, in which I try to ANSWER an incoming OFFER I was trying to refactor it and split the webrtcbin object generation from the input pipeline.</div><div style="background-color: rgb(255, 255, 255); line-height: 21px;" class=""><br class=""></div><div style="background-color: rgb(255, 255, 255); line-height: 21px;" class=""><div style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><div class=""><span style="color: #006078;" class="">PIPELINE_TEST_VP8_2</span> <span style="color: #7f0055;" class="">=</span> '''</div><div class="">videotestsrc is-live=true pattern=ball ! </div><div class="">videoconvert ! </div><div class="">queue ! </div><div class="">vp8enc deadline=1 ! </div><div class="">queue ! </div><div class="">rtpvp8pay ! </div><div class="">queue ! </div><div class="">application/x-rtp,media=video,encoding-name=VP8  ! </div><div class="">webrtcbin</div><div class="">'''</div></div></div><div style="background-color: rgb(255, 255, 255); line-height: 21px;" class=""><br class=""></div><div style="background-color: rgb(255, 255, 255); line-height: 21px;" class=""><div style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><div class="">    <span style="color: #210de5;font-weight: bold;" class="">def</span> <span style="color: #1200bb;" class="">start_pipeline</span>(<span style="color: #ab3c11;font-style: italic;" class="">self</span>):</div><div class="">        <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">pipe</span> <span style="color: rgb(127, 0, 85);" class="">=</span> Gst.parse_launch(<span style="color: rgb(0, 96, 120);" class="">PIPELINE_TEST_VP8_2</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span> <span style="color: #7f0055;" class="">=</span> Gst.<span style="color: #265cd1;" class="">ElementFactory</span>.make(<span style="color: #d126d1;" class="">"webrtcbin"</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.set_property(<span style="color: #d126d1;" class="">"bundle-policy"</span>, <span style="color: #d126d1;" class="">"max-bundle"</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.set_property(<span style="color: #d126d1;" class="">"name"</span>, <span style="color: #d126d1;" class="">"webrtcbin"</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.set_property(<span style="color: #d126d1;" class="">"stun-server"</span>, <span style="color: #d126d1;" class="">"<a href="stun://stun.l.google.com:19302" class="">stun://stun.l.google.com:19302</a>"</span>)</div><div class="">        <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">if</span> Gst.version().<span style="color: rgb(38, 92, 209);" class="">major</span> <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">>=</span> <span style="color: rgb(255, 128, 0);" class="">1</span> <span style="color: rgb(127, 0, 85);" class="">and</span> Gst.version().<span style="color: rgb(38, 92, 209);" class="">minor</span> <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">>=</span> <span style="color: rgb(255, 128, 0);" class="">17</span>:</div><div class="">            trans <span style="color: #7f0055;" class="">=</span> <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.emit(<span style="color: #d126d1;" class="">'get-transceiver'</span>, <span style="color: #ff8000;" class="">0</span>)</div><div class="">            <span style="color: #7f0055;font-weight: bold;" class="">if</span> <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">direction</span> <span style="color: #7f0055;font-weight: bold;" class="">==</span> <span style="color: #d126d1;" class="">'sendonly'</span>:</div><div class="">                trans.set_property(<span style="color: #d126d1;" class="">'direction'</span>, GstWebRTC.<span style="color: #265cd1;" class="">WebRTCRTPTransceiverDirection</span>.<span style="color: #006078;" class="">SENDONLY</span>)</div><div class="">            <span style="color: #7f0055;font-weight: bold;" class="">elif</span> <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">direction</span> <span style="color: #7f0055;font-weight: bold;" class="">==</span> <span style="color: #d126d1;" class="">'recvonly'</span>:</div><div class="">                trans.set_property(<span style="color: #d126d1;" class="">'direction'</span>, GstWebRTC.<span style="color: #265cd1;" class="">WebRTCRTPTransceiverDirection</span>.<span style="color: #006078;" class="">RECVONLY</span>)</div><div class="">            <span style="color: #7f0055;font-weight: bold;" class="">else</span>:</div><div class="">                trans.set_property(<span style="color: #d126d1;" class="">'direction'</span>, GstWebRTC.<span style="color: #265cd1;" class="">WebRTCRTPTransceiverDirection</span>.<span style="color: #006078;" class="">SENDRECV</span>)</div><div class="">        <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">webrtcbin</span>.connect(<span style="color: rgb(209, 38, 209);" class="">'on-negotiation-needed'</span>, <span style="color: rgb(127, 0, 85); font-weight: bold;" class="">self</span>.<span style="color: rgb(38, 92, 209);" class="">on_negotiation_needed</span>) </div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'on-ice-candidate'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_ice_candidate</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'pad-added'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_pad_added</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::connection-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_connection_state</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::signaling-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_signaling_state</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::ice-connection-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_ice_connection_state</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>.connect(<span style="color: #d126d1;" class="">'notify::ice-gathering-state'</span>, <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">on_ice_gathering_state</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">pipe</span>.add(<span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">webrtcbin</span>)</div><div class="">        <span style="color: #7f0055;font-weight: bold;" class="">self</span>.<span style="color: #265cd1;" class="">pipe</span>.set_state(Gst.<span style="color: #265cd1;" class="">State</span>.<span style="color: #006078;" class="">PLAYING</span>)</div><br class=""></div><div style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div><div style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class="">The first problem with this is the missing "trans":</div><div style="line-height: 21px;" class=""><font face="Fira Code, Menlo, Monaco, Courier New, monospace, Menlo, Monaco, Courier New, monospace" class=""><span style="white-space: pre;" class=""><br class=""></span></font></div><div style="line-height: 21px;" class=""><font face="Fira Code, Menlo, Monaco, Courier New, monospace, Menlo, Monaco, Courier New, monospace" class=""><span style="white-space: pre;" class="">0:00:00.352922991 11197 0xb2847240 ERROR              webrtcbin gstwebrtcbin.c:5032:gst_webrtc_bin_get_transceiver:<webrtcbin> No transceiver for idx 0</span></font><span style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; white-space: pre;" class="">
</span></div><div class=""><br class=""></div><div style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div><div style="line-height: 21px;" class=""><font face="Fira Code, Menlo, Monaco, Courier New, monospace, Menlo, Monaco, Courier New, monospace" class=""><span style="white-space: pre;" class="">trans.set_property('direction', GstWebRTC.WebRTCRTPTransceiverDirection.SENDONLY)
AttributeError: 'NoneType' object has no attribute 'set_property'</span></font><span style="font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; white-space: pre;" class="">
</span></div><div class=""><br class=""></div><div class="">But even if I omit the entire part to determine the transceiver, the result is still not working, because this is my OFFER then:</div><div class=""><br class=""></div><div class=""><div class="">v=0</div><div class="">o=- 4039551208253794554 0 IN IP4 0.0.0.0</div><div class="">s=-</div><div class="">t=0 0</div><div class="">a=ice-options:trickle</div><div class="">a=group:BUNDLE</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I suppose there is something wrong with the inputs definitions, but before I go and create them manually I wanted to at least have some success with this.</div><div class=""><br class=""></div><div class="">Does anybody have a pointer, what's going wrong here?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div style="background-color: rgb(255, 255, 255); font-family: "Fira Code", Menlo, Monaco, "Courier New", monospace, Menlo, Monaco, "Courier New", monospace; line-height: 21px; white-space: pre;" class=""><br class=""></div></div></body></html>