webrtcbin create-answer returns unknown SDP type

Matthew Waters ystreet00 at gmail.com
Wed Jul 6 11:40:34 UTC 2022


Interesting.

If you separate out this line:

answer = promise.get_reply().get_value("answer")

to:

reply = promise.get_reply()
answer = reply.get_value("answer")

Then it will work.

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.

This is the good case:

0:00:26.515777326 221861 0x555555684f00 ERROR              webrtcbin
gstwebrtcbin.c:4584:_create_sdp_task: returning
application/x-gst-promise, answer=(GstWebRTCSessionDescription)NULL;
INFO     __main__:on answer: <Gst.Promise object at 0x7fffe8c593c0
(GstPromise at 0x555555ade1b0)> <__gi__.GstWebRTCBin object at
0x7fffe9a43400 (GstWebRTCBin at 0x555555ac4120)> None

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
72      if (!src)
(gdb)
Continuing.
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'
INFO     __main__:reply: application/x-gst-promise,
answer=(GstWebRTCSessionDescription)NULL;
INFO     __main__:answer: <GstWebRTC.WebRTCSessionDescription object at
0x7fffe8c5a9e0 (GstWebRTCSessionDescription at 0x7fffd8116b20)>
INFO     __main__:answer fields: <enum GST_WEBRTC_SDP_TYPE_ANSWER of
type GstWebRTC.WebRTCSDPType>
INFO     __main__:answer fields: <enum GST_WEBRTC_SDP_TYPE_ANSWER of
type GstWebRTC.WebRTCSDPType> 3
INFO     __main__:answer fields: <enum GST_WEBRTC_SDP_TYPE_ANSWER of
type GstWebRTC.WebRTCSDPType> answer
INFO     __main__:answer sdp is None: False
INFO     __main__:answer fields: <GstSdp.SDPMessage object at
0x7fffe8c5aa40 (GstSDPMessage at 0x7fffd811a740)>
INFO     __main__:answer sdp: v=0

Bad case:

0:00:36.984435665 222001 0x555555685300 ERROR              webrtcbin
gstwebrtcbin.c:4584:_create_sdp_task: returning
application/x-gst-promise, answer=(GstWebRTCSessionDescription)NULL;
INFO     __main__:on answer: <Gst.Promise object at 0x7fffe8c593c0
(GstPromise at 0x555555aca2c0)> <__gi__.GstWebRTCBin object at
0x7fffe8c199c0 (GstWebRTCBin at 0x555555ac4120)> None

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
72      if (!src)
(gdb)
Continuing.

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
92      g_return_if_fail (desc != NULL);
(gdb) bt
#0  gst_webrtc_session_description_free (desc=0x7fffd8116760) at
../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/rtcsessiondescription.c:92
#1  0x00007fffe9e30008 in g_value_unset
(value=value at entry=0x7fffd8118330) at
../subprojects/glib/gobject/gvalue.c:311
#2  0x00007fffe8f4f4be in gst_structure_free (structure=0x7fffd8118300)
at ../subprojects/gstreamer/gst/gststructure.c:538
#3  0x00007fffe9fd71db in boxed_clear (self=0x7fffe8c5a980) at
../subprojects/pygobject/gi/pygi-boxed.c:51
#4  boxed_dealloc (self=0x7fffe8c5a980) at
../subprojects/pygobject/gi/pygi-boxed.c:69
#5  0x00007ffff7d29076 in subtype_dealloc () from
/lib64/libpython3.10.so.1.0
#6  0x00007fffe9fcc475 in _Py_DECREF (op=<optimized out>) at
/usr/include/python3.10/object.h:500
#7  _callable_info_dealloc (self=0x7fffe8c39bf0) at
../subprojects/pygobject/gi/pygi-info.c:685
#8  0x00007ffff7d17b00 in _PyEval_EvalFrameDefault () from
/lib64/libpython3.10.so.1.0
#9  0x00007ffff7d118d3 in _PyEval_Vector () from /lib64/libpython3.10.so.1.0
#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
#11 0x00007ffff7fb0322 in ffi_closure_unix64_inner () from
/lib64/libffi.so.8
#12 0x00007ffff7fb0968 in ffi_closure_unix64 () from /lib64/libffi.so.8
#13 0x00007fffe9182bc1 in _execute_op (op=0x555555aca3a0) at
../subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c:1007
#14 0x00007fffe9ecc19f in g_main_dispatch (context=0x7fffd8000b70) at
../subprojects/glib/glib/gmain.c:3417
#15 g_main_context_dispatch (context=0x7fffd8000b70) at
../subprojects/glib/glib/gmain.c:4135
#16 0x00007fffe9ecc528 in g_main_context_iterate
(context=0x7fffd8000b70, block=block at entry=1, dispatch=dispatch at entry=1,
self=<optimized out>) at ../subprojects/glib/glib/gmain.c:4211
#17 0x00007fffe9ecc7cf in g_main_loop_run (loop=0x7fffd8002580) at
../subprojects/glib/glib/gmain.c:4411
#18 0x00007fffe9185146 in _gst_pc_thread (webrtc=0x555555ac4120) at
../subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c:928
#19 0x00007fffe9ef4fad in g_thread_proxy (data=0x555555685300) at
../subprojects/glib/glib/gthread.c:827
#20 0x00007ffff788ce2d in start_thread () from /lib64/libc.so.6
#21 0x00007ffff7912620 in clone3 () from /lib64/libc.so.6
(gdb) c
Continuing.
INFO     __main__:answer: <GstWebRTC.WebRTCSessionDescription object at
0x7fffe8c5a9e0 (GstWebRTCSessionDescription at 0x7fffd8116760)>
INFO     __main__:answer fields: <enum 669822870 of type
GstWebRTC.WebRTCSDPType>
INFO     __main__:answer fields: <enum 669822870 of type
GstWebRTC.WebRTCSDPType> 669822870
INFO     __main__:answer fields: <enum 669822870 of type
GstWebRTC.WebRTCSDPType> unknown
INFO     __main__:answer sdp is None: True
INFO     __main__:answer fields: None
Traceback (most recent call last):

Cheers
-Matt

On 6/7/22 20:55, Alexei Golovko wrote:
> `apt show python3-gst-1.0` gives me version 1.20.1
>
> Also I made a minimal example without external dependencies: just set
> hardcoded SDP as local-description and emit create-answer.
> https://pastebin.com/9xPk6EkY
> It also prints unknown SDP type, new enum value each run:
> https://pastebin.com/zKhDsLZZ
>
> This behaviour also reproduces with python 3.9 on NixOS 22.05 (I've
> used the following shell.nix: https://pastebin.com/vsBG5RXR).
>
> вт, 5 июл. 2022 г. в 17:33, Matthew Waters <ystreet00 at gmail.com>:
>
>     Looks like you are looking for python3-gst-1.0:
>     https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=python3-gst&searchon=names
>     <https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=python3-gst&searchon=names>.
>
>     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.
>
>     On 5/7/22 23:19, Alexei Golovko wrote:
>>     I have installed python3-gi package from apt repository, version
>>     3.42.0-3build1.
>>     Yes, value for the enum changes each run.
>>     Could you give advice on how to check if this is a python binding
>>     problem or lower-level one?
>>
>>     вт, 5 июл. 2022 г. в 16:02, Matthew Waters <ystreet00 at gmail.com>:
>>
>>         Please keep the list in CC so others searching for the same
>>         issue might find a solution.
>>
>>         PyGObject is not gst-python.  gst-python provides some
>>         convenience API on top of PyGObject and may be required in
>>         this case.
>>
>>         That log is expected for your case (no existing transceiver
>>         or pad).
>>
>>         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.
>>
>>         Cheers
>>         -Matt
>>
>>         On 5/7/22 22:41, Alexei Golovko wrote:
>>>         Here is the log with GST_DEBUG=3,*webrtc*:7 —
>>>         https://pastebin.com/RshtnqQx
>>>         I use PyGObject 3.42.1.
>>>
>>>         I see in logs following lines:
>>>         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
>>>         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)
>>>
>>>         Maybe they are related to the problem, though I am not sure.
>>>
>>>         вт, 5 июл. 2022 г. в 15:12, Matthew Waters
>>>         <ystreet00 at gmail.com>:
>>>
>>>             Hi,
>>>
>>>             That SDP doesn't actually exist as a valid value.  You
>>>             can enable
>>>             GStreamer debugging with GST_DEBUG=3,*webrtc*:7 and that
>>>             may show
>>>             something interesting.
>>>
>>>             Otherwise, one has to figure out if the python bindings
>>>             are doing
>>>             something weird here.  I assume you have a relevant
>>>             gst-python
>>>             installation available and in use.
>>>
>>>             Cheers
>>>             -Matt
>>>
>>>             On 5/7/22 02:44, Alexei Golovko via gstreamer-devel wrote:
>>>             > Hi,
>>>             > I try to use webrtcbin with Janus.
>>>             > I've found examples like
>>>             >
>>>             https://github.com/centricular/gstwebrtc-demos/blob/master/janus/janusvideoroom.py,
>>>             >
>>>             https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/master/tests/examples/webrtc/webrtcrenego.c,
>>>             >
>>>             https://github.com/centricular/gstwebrtc-demos/blob/master/sendrecv/gst-rust/src/main.rs,
>>>             >
>>>             https://gitlab.freedesktop.org/gstreamer/gst-examples/-/blob/master/webrtc/sendrecv/gst/webrtc_sendrecv.py.
>>>             >
>>>             > They tend to create an offer locally, send it to
>>>             Janus, receive an
>>>             > answer and set it as a remote description. I would
>>>             like to mimic
>>>             > behaviour, which we used to use with python's aiortc:
>>>             get an offer
>>>             > from Janus, generate an answer and send it back.
>>>             >
>>>             > I set SDP offer from Janus with
>>>             set-remote-description, then emit
>>>             > create-answer; but I get an answer
>>>             WebRTCSessionDescription with an
>>>             > empty SDP and a very strange WebRTCSDPType=-43384639
>>>             (non-existing enum?).
>>>             >
>>>             > What am I doing wrong and how to fix this?
>>>             >
>>>             > The python script used is here:
>>>             https://pastebin.com/WGPcF64m
>>>             > Module dvr_processor.dvr_processor.janus contains
>>>             communication with
>>>             > Janus: https://pastebin.com/KAhTv8Lq
>>>             > Logs are here: https://pastebin.com/QVegDhRZ
>>>             >
>>>             > It is gstreamer 1.20.1 on ubuntu-22.04 based image.
>>>             >
>>>             > Regards,
>>>             > Alexei Golovko.
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220706/fc9172fb/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220706/fc9172fb/attachment-0001.sig>


More information about the gstreamer-devel mailing list