Closed petergerten closed 4 years ago
Debugging this further I found:
0:00:01.060533443 546 0x7f5cd8002920 WARN webrtcbin gstwebrtcbin.c:2516:_create_answer_task:<sendrecv> format field of data channel m= line is not 'webrtc-datachannel'
The root cause seems to be this (but with Janus instead of Chrome) https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/commit/831b12497613a33ae578c529569402118c392ac9
Apparently there is a workaround for old SDP format in gstreamer master but not in the latest release (1.16.2).
We support both old and new format in the core, since at least some time ago Chrome and Firefox had different kind of supports. Typically, when it's the browser offering, we reply using the format that was offered, for better compatibility. When it's Janus offering, it's different of course, as we don't know in advance what will be supported: it's usually up to plugins, and good chances are the Streaming plugin is still using the old syntax in its template.
The template to generate the datachannel m-line is here, so you can try tweaking that to use the new syntax instead: https://github.com/meetecho/janus-gateway/blob/master/plugins/janus_streaming.c#L4782-L4784
If you can confirm it works with gstreamer, we can check if browsers are known to all use the new approach and possibly stick to it.
Thanks Lorenzo. After I changed the relevant lines in janus_streaming.c to:
g_snprintf(buffer, 512,
"m=application 54111 UDP/DTLS/SCTP webrtc-datachannel\r\n"
"a=sctp-port:5000\r\n"
"c=IN IP4 1.1.1.1\r\n");
everything works.
Changed both Streaming and TextRoom plugins so that they use the proper way of negotiating datachannels: https://github.com/meetecho/janus-gateway/commit/f8cc4f70c8dbaccc71d69207e4b32da5c19b7c95. I tested this briefly with recent versions of Chrome and Firefox and it seemed to work as expected.
Janus: master(today) GStreamer: 1.16.2
Connecting to the Janus streaming plugin with datachannel enabled using gstreamer, I get an ICE failure. Without datachannel there is no problem.
Relevant messages in gstreamer log:
This issue has been observed before (though not with Janus), but not solved. The poster in the below thread disabled datachannels: https://github.com/centricular/gstwebrtc-demos/issues/113
The conclusion in that thread was: "The datachannel format used in that SDP is the old format that is not supported by webrtcbin which is hinted at by the 0 port in the sdp answer and the log line '0:00:12.855077000 82505 0x7fb402c50320 INFO webrtcbin gstwebrtcbin.c:2168:_create_answer_task: media 2 rejected'"
Now I am not sure what the "old format" SDP that is not supported by webrtcbin is. This is the SDP from janus in question: https://pastebin.com/MhanpECW