<div dir="ltr"><div>Great thanks for the workaround!</div><div><br></div><div>Should I report this as a bug on <a href="https://gitlab.freedesktop.org/groups/gstreamer/-/issues">https://gitlab.freedesktop.org/groups/gstreamer/-/issues</a> with gst-python as a project?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, 6 июл. 2022 г. в 14:40, Matthew Waters <<a href="mailto:ystreet00@gmail.com">ystreet00@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    Interesting.<br>
    <br>
    If you separate out this line:<br>
    <br>
    answer = promise.get_reply().get_value("answer")<br>
    <br>
    to:<br>
    <br>
    reply = promise.get_reply()<br>
    answer = reply.get_value("answer")<br>
    <br>
    Then it will work.<br>
    <br>
    I think this has to do with the temporary copy that python makes
    when calling get_reply() that disappears too early?  This is likely
    a bug somewhere in the python bindings.<br>
    <br>
    This is the good case:<br>
    <br>
    0:00:26.515777326 221861 0x555555684f00 ERROR              webrtcbin
    gstwebrtcbin.c:4584:_create_sdp_task: returning
    application/x-gst-promise, answer=(GstWebRTCSessionDescription)NULL;<br>
    INFO     __main__:on answer: <Gst.Promise object at
    0x7fffe8c593c0 (GstPromise at 0x555555ade1b0)>
    <__gi__.GstWebRTCBin object at 0x7fffe9a43400 (GstWebRTCBin at
    0x555555ac4120)> None<br>
    <br>
    Thread 3 "wrb:pc" hit Breakpoint 1,
    gst_webrtc_session_description_copy (src=0x7fffd81147b0) at
../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/rtcsessiondescription.c:72<br>
    72      if (!src)<br>
    (gdb) <br>
    Continuing.<br>
    0:00:31.294220789 221861 0x555555684f00 WARN               structure
    gststructure.c:2093:priv_gst_structure_append_to_gstring: No value
    transform to serialize field 'answer' of type
    'GstWebRTCSessionDescription'<br>
    INFO     __main__:reply: application/x-gst-promise,
    answer=(GstWebRTCSessionDescription)NULL;<br>
    INFO     __main__:answer: <GstWebRTC.WebRTCSessionDescription
    object at 0x7fffe8c5a9e0 (GstWebRTCSessionDescription at
    0x7fffd8116b20)><br>
    INFO     __main__:answer fields: <enum GST_WEBRTC_SDP_TYPE_ANSWER
    of type GstWebRTC.WebRTCSDPType><br>
    INFO     __main__:answer fields: <enum GST_WEBRTC_SDP_TYPE_ANSWER
    of type GstWebRTC.WebRTCSDPType> 3<br>
    INFO     __main__:answer fields: <enum GST_WEBRTC_SDP_TYPE_ANSWER
    of type GstWebRTC.WebRTCSDPType> answer<br>
    INFO     __main__:answer sdp is None: False<br>
    INFO     __main__:answer fields: <GstSdp.SDPMessage object at
    0x7fffe8c5aa40 (GstSDPMessage at 0x7fffd811a740)><br>
    INFO     __main__:answer sdp: v=0<br>
    <br>
    Bad case:<br>
    <br>
    0:00:36.984435665 222001 0x555555685300 ERROR              webrtcbin
    gstwebrtcbin.c:4584:_create_sdp_task: returning
    application/x-gst-promise, answer=(GstWebRTCSessionDescription)NULL;<br>
    INFO     __main__:on answer: <Gst.Promise object at
    0x7fffe8c593c0 (GstPromise at 0x555555aca2c0)>
    <__gi__.GstWebRTCBin object at 0x7fffe8c199c0 (GstWebRTCBin at
    0x555555ac4120)> None<br>
    <br>
    Thread 3 "wrb:pc" hit Breakpoint 1,
    gst_webrtc_session_description_copy (src=0x7fffd8116150) at
../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/rtcsessiondescription.c:72<br>
    72      if (!src)<br>
    (gdb) <br>
    Continuing.<br>
    <br>
    Thread 3 "wrb:pc" hit Breakpoint 2,
    gst_webrtc_session_description_free (desc=0x7fffd8116760) at
../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/rtcsessiondescription.c:92<br>
    92      g_return_if_fail (desc != NULL);<br>
    (gdb) bt<br>
    #0  gst_webrtc_session_description_free (desc=0x7fffd8116760) at
../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/rtcsessiondescription.c:92<br>
    #1  0x00007fffe9e30008 in g_value_unset
    (value=value@entry=0x7fffd8118330) at
    ../subprojects/glib/gobject/gvalue.c:311<br>
    #2  0x00007fffe8f4f4be in gst_structure_free
    (structure=0x7fffd8118300) at
    ../subprojects/gstreamer/gst/gststructure.c:538<br>
    #3  0x00007fffe9fd71db in boxed_clear (self=0x7fffe8c5a980) at
    ../subprojects/pygobject/gi/pygi-boxed.c:51<br>
    #4  boxed_dealloc (self=0x7fffe8c5a980) at
    ../subprojects/pygobject/gi/pygi-boxed.c:69<br>
    #5  0x00007ffff7d29076 in subtype_dealloc () from
    /lib64/libpython3.10.so.1.0<br>
    #6  0x00007fffe9fcc475 in _Py_DECREF (op=<optimized out>) at
    /usr/include/python3.10/object.h:500<br>
    #7  _callable_info_dealloc (self=0x7fffe8c39bf0) at
    ../subprojects/pygobject/gi/pygi-info.c:685<br>
    #8  0x00007ffff7d17b00 in _PyEval_EvalFrameDefault () from
    /lib64/libpython3.10.so.1.0<br>
    #9  0x00007ffff7d118d3 in _PyEval_Vector () from
    /lib64/libpython3.10.so.1.0<br>
    #10 0x00007fffe9fd7d41 in _pygi_closure_handle (cif=<optimized
    out>, result=<optimized out>, args=<optimized out>,
    data=<optimized out>) at
    ../subprojects/pygobject/gi/pygi-closure.c:582<br>
    #11 0x00007ffff7fb0322 in ffi_closure_unix64_inner () from
    /lib64/libffi.so.8<br>
    #12 0x00007ffff7fb0968 in ffi_closure_unix64 () from
    /lib64/libffi.so.8<br>
    #13 0x00007fffe9182bc1 in _execute_op (op=0x555555aca3a0) at
    ../subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c:1007<br>
    #14 0x00007fffe9ecc19f in g_main_dispatch (context=0x7fffd8000b70)
    at ../subprojects/glib/glib/gmain.c:3417<br>
    #15 g_main_context_dispatch (context=0x7fffd8000b70) at
    ../subprojects/glib/glib/gmain.c:4135<br>
    #16 0x00007fffe9ecc528 in g_main_context_iterate
    (context=0x7fffd8000b70, block=block@entry=1,
    dispatch=dispatch@entry=1, self=<optimized out>) at
    ../subprojects/glib/glib/gmain.c:4211<br>
    #17 0x00007fffe9ecc7cf in g_main_loop_run (loop=0x7fffd8002580) at
    ../subprojects/glib/glib/gmain.c:4411<br>
    #18 0x00007fffe9185146 in _gst_pc_thread (webrtc=0x555555ac4120) at
    ../subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c:928<br>
    #19 0x00007fffe9ef4fad in g_thread_proxy (data=0x555555685300) at
    ../subprojects/glib/glib/gthread.c:827<br>
    #20 0x00007ffff788ce2d in start_thread () from /lib64/libc.so.6<br>
    #21 0x00007ffff7912620 in clone3 () from /lib64/libc.so.6<br>
    (gdb) c<br>
    Continuing.<br>
    INFO     __main__:answer: <GstWebRTC.WebRTCSessionDescription
    object at 0x7fffe8c5a9e0 (GstWebRTCSessionDescription at
    0x7fffd8116760)><br>
    INFO     __main__:answer fields: <enum 669822870 of type
    GstWebRTC.WebRTCSDPType><br>
    INFO     __main__:answer fields: <enum 669822870 of type
    GstWebRTC.WebRTCSDPType> 669822870<br>
    INFO     __main__:answer fields: <enum 669822870 of type
    GstWebRTC.WebRTCSDPType> unknown<br>
    INFO     __main__:answer sdp is None: True<br>
    INFO     __main__:answer fields: None<br>
    Traceback (most recent call last):<br>
    <br>
    Cheers<br>
    -Matt<br>
    <br>
    <div>On 6/7/22 20:55, Alexei Golovko wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>`apt show python3-gst-1.0` gives me version 1.20.1</div>
        <div><br>
        </div>
        <div>Also I made a minimal example without external
          dependencies: just set hardcoded SDP as local-description and
          emit create-answer. <a href="https://pastebin.com/9xPk6EkY" target="_blank">https://pastebin.com/9xPk6EkY</a></div>
        <div>It also prints unknown SDP type, new enum value each run: <a href="https://pastebin.com/zKhDsLZZ" target="_blank">https://pastebin.com/zKhDsLZZ</a></div>
        <div><br>
        </div>
        <div>This behaviour also reproduces with python 3.9 on NixOS
          22.05 (I've used the following shell.nix: <a href="https://pastebin.com/vsBG5RXR" target="_blank">https://pastebin.com/vsBG5RXR</a>).<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">вт, 5 июл. 2022 г. в 17:33,
          Matthew Waters <<a href="mailto:ystreet00@gmail.com" target="_blank">ystreet00@gmail.com</a>>:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div> Looks like you are looking for python3-gst-1.0: <a href="https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=python3-gst&searchon=names" target="_blank">https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=python3-gst&searchon=names</a>.<br>
            <br>
            I don't know how exactly the python bindings operate so
            cannot give you that information.  Others on this list may
            be able to point you in the right direction.<br>
            <br>
            <div>On 5/7/22 23:19, Alexei Golovko wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>I have installed python3-gi package from apt
                  repository, version 3.42.0-3build1.</div>
                <div>Yes, value for the enum changes each run.</div>
                <div>Could you give advice on how to check if this is a
                  python binding problem or lower-level one?<br>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">вт, 5 июл. 2022 г. в
                  16:02, Matthew Waters <<a href="mailto:ystreet00@gmail.com" target="_blank">ystreet00@gmail.com</a>>:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                  <div> Please keep the list in CC so others searching
                    for the same issue might find a solution.<br>
                    <br>
                    PyGObject is not gst-python.  gst-python provides
                    some convenience API on top of PyGObject and may be
                    required in this case.<br>
                    <br>
                    That log is expected for your case (no existing
                    transceiver or pad).<br>
                    <br>
                    The value for the enum is different from your last
                    run.  This points to uninitialized/random memory
                    being accessed.  You would need to figure out if
                    that's in the python translation layer or not.<br>
                    <br>
                    Cheers<br>
                    -Matt<br>
                    <br>
                    <div>On 5/7/22 22:41, Alexei Golovko wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">
                        <div>Here is the log with GST_DEBUG=3,*webrtc*:7
                          — <a href="https://pastebin.com/RshtnqQx" target="_blank">https://pastebin.com/RshtnqQx</a><br>
                        </div>
                        <div>I use PyGObject 3.42.1.</div>
                        <div><br>
                        </div>
                        <div>I see in logs following lines:</div>
                        <div>2022-07-05 15:15:57.949 jord ERROR|
                          0:00:01.214992971     9 0x55e2cbd19980 DEBUG  
                                     webrtcbin
                          gstwebrtcbin.c:1874:_find_codec_preferences:<webrtctransceiver0>
                          Could not find caps for mline 0<br>
                          2022-07-05 15:15:57.949 jord ERROR|
                          0:00:01.215007126     9 0x55e2cbd19980 TRACE  
                                     webrtcbin
                          gstwebrtcbin.c:4071:_create_answer_task:<wrb>
                          trying to compare application/x-rtp,
                          media=(string)video, payload=(int)96,
                          clock-rate=(int)90000,
                          encoding-name=(string)H264,
                          profile-level-id=(string)42e01f,
                          packetization-mode=(string)1,
                          rtcp-fb-nack=(boolean)true,
                          rtcp-fb-nack-pli=(boolean)true,
                          rtcp-fb-goog-remb=(boolean)true;
                          application/x-rtp, media=(string)video,
                          payload=(int)97, clock-rate=(int)90000,
                          encoding-name=(string)RTX, apt=(string)96 and
                          (NULL)</div>
                        <div><br>
                        </div>
                        <div>Maybe they are related to the problem,
                          though I am not sure.<br>
                        </div>
                      </div>
                      <br>
                      <div class="gmail_quote">
                        <div dir="ltr" class="gmail_attr">вт, 5 июл.
                          2022 г. в 15:12, Matthew Waters <<a href="mailto:ystreet00@gmail.com" target="_blank">ystreet00@gmail.com</a>>:<br>
                        </div>
                        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
                          <br>
                          That SDP doesn't actually exist as a valid
                          value.  You can enable<br>
                          GStreamer debugging with
                          GST_DEBUG=3,*webrtc*:7 and that may show<br>
                          something interesting.<br>
                          <br>
                          Otherwise, one has to figure out if the python
                          bindings are doing<br>
                          something weird here.  I assume you have a
                          relevant gst-python<br>
                          installation available and in use.<br>
                          <br>
                          Cheers<br>
                          -Matt<br>
                          <br>
                          On 5/7/22 02:44, Alexei Golovko via
                          gstreamer-devel wrote:<br>
                          > Hi,<br>
                          > I try to use webrtcbin with Janus.<br>
                          > I've found examples like<br>
                          > <a href="https://github.com/centricular/gstwebrtc-demos/blob/master/janus/janusvideoroom.py" rel="noreferrer" target="_blank">https://github.com/centricular/gstwebrtc-demos/blob/master/janus/janusvideoroom.py</a>,<br>
                          > <a href="https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/master/tests/examples/webrtc/webrtcrenego.c" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/master/tests/examples/webrtc/webrtcrenego.c</a>,<br>
                          > <a href="https://github.com/centricular/gstwebrtc-demos/blob/master/sendrecv/gst-rust/src/main.rs" rel="noreferrer" target="_blank">https://github.com/centricular/gstwebrtc-demos/blob/master/sendrecv/gst-rust/src/main.rs</a>,<br>
                          > <a href="https://gitlab.freedesktop.org/gstreamer/gst-examples/-/blob/master/webrtc/sendrecv/gst/webrtc_sendrecv.py" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/gstreamer/gst-examples/-/blob/master/webrtc/sendrecv/gst/webrtc_sendrecv.py</a>.<br>
                          ><br>
                          > They tend to create an offer locally,
                          send it to Janus, receive an<br>
                          > answer and set it as a remote
                          description. I would like to mimic<br>
                          > behaviour, which we used to use with
                          python's aiortc: get an offer<br>
                          > from Janus, generate an answer and send
                          it back.<br>
                          ><br>
                          > I set SDP offer from Janus with
                          set-remote-description, then emit<br>
                          > create-answer; but I get an answer
                          WebRTCSessionDescription with an<br>
                          > empty SDP and a very strange
                          WebRTCSDPType=-43384639 (non-existing enum?).<br>
                          ><br>
                          > What am I doing wrong and how to fix
                          this?<br>
                          ><br>
                          > The python script used is here: <a href="https://pastebin.com/WGPcF64m" rel="noreferrer" target="_blank">https://pastebin.com/WGPcF64m</a><br>
                          > Module dvr_processor.dvr_processor.janus
                          contains communication with<br>
                          > Janus: <a href="https://pastebin.com/KAhTv8Lq" rel="noreferrer" target="_blank">https://pastebin.com/KAhTv8Lq</a><br>
                          > Logs are here: <a href="https://pastebin.com/QVegDhRZ" rel="noreferrer" target="_blank">https://pastebin.com/QVegDhRZ</a><br>
                          ><br>
                          > It is gstreamer 1.20.1 on ubuntu-22.04
                          based image.<br>
                          ><br>
                          > Regards,<br>
                          > Alexei Golovko.<br>
                          <br>
                        </blockquote>
                      </div>
                    </blockquote>
                    <br>
                  </div>
                </blockquote>
              </div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div></div>