This happens in videoroom plugin when you try to open data channel only connection without any media streams. The easiest way to reproduce this is to alter 'publishOwnFeed' function in videoroomtest.js so it doesn't ask for media like so and try to join room on Safari browser
function publishOwnFeed(useAudio) {
// Publish our stream
$('#publish').attr('disabled', true).unbind('click');
sfutest.createOffer(
{
// Add data:true here if you want to publish datachannels as well
media: { audioRecv: false, videoRecv: false, audioSend: false, videoSend: false , data:true}, // Publishers are sendonly
// If you want to test simulcasting (Chrome and Firefox only), then
// pass a ?simulcast=true when opening this demo page: it will turn
// the following 'simulcast' property to pass to janus.js to true
simulcast: doSimulcast,
success: function(jsep) {
Janus.debug("Got publisher SDP!");
Janus.debug(jsep);
var publish = { "request": "configure", "audio": false, "video": false, "data":true };
// You can force a specific codec to use when publishing by using the
// audiocodec and videocodec properties, for instance:
// publish["audiocodec"] = "opus"
// to force Opus as the audio codec to use, or:
// publish["videocodec"] = "vp9"
// to force VP9 as the videocodec to use. In both case, though, forcing
// a codec will only work if: (1) the codec is actually in the SDP (and
// so the browser supports it), and (2) the codec is in the list of
// allowed codecs in a room. With respect to the point (2) above,
// refer to the text in janus.plugin.videoroom.cfg for more details
sfutest.send({"message": publish, "jsep": jsep});
},
error: function(error) {
Janus.error("WebRTC error:", error);
if (useAudio) {
publishOwnFeed(false);
} else {
bootbox.alert("WebRTC error... " + JSON.stringify(error));
$('#publish').removeAttr('disabled').click(function() { publishOwnFeed(true); });
}
}
});
}
Tested with Chrome and works just as expected. Maybe you didn't compile with usrsctplib support?
Works perfectly fine on chrome and happens only on Safari. You can test this even on your
demo if you overwrite publishOwnFeed function
happens only on Safari.
Then you should say so in the title.
My bad sorry.
I don't have access to a Safari browser and won't until the end of the month.
Okay, just few notes:
I haven't noticed this before so it may started with new version of Safari included in macOS Catalina and iOS 13.
If you first publish your feed with streams and data channel enabled .. then unpublish and then publish again with data channel only, everything works
It looks like a \r is missing from the incoming JSEP Offer
1220 JANUS_LOG(LOG_VERB, "[%"SCNu64"] Remote SDP:\n%s", handle->handle_id, jsep_sdp);
(gdb) p jsep_sdp
$1 = 0x7fff30004cf0 "v=0\r\no=- 5579826872295925204 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\na=ice-ufrag:NRdu\r\na=ice-pwd:FLroZ+qxtf13ODODXHRjA/H4\r\na=ice-options:trickle\r\na=fingerprint:sha-256 1B:40:00:74:A7:C7:13:2D:55:D6:ED:5D:B4:67:DB:2D:D7:DD:68:0A:33:B1:13:CF:96:FC:30:C5:22:22:E8:52\r\na=setup:actpass\r\na=mid:0\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n"
Notice the part c=IN IP4 0.0.0.0\na=ice-ufrag:NRdu\r\n, Janus will just interpret this as a whole c line and will skip the ice-ufrag attribute, leading to the discussed issue.
NOTE: I've reproduced this on Safari 13.0.2
Printing the offer in the JS console confirms a missing \r.
This is a bug in Safari.
Closing then.
FYI, I've submitted the issue on the webkit bug tracker: https://bugs.webkit.org/show_bug.cgi?id=203190
@picitujeromanov I changed the code to be more tolerant when parsing SDP lines, by splitting on \n alone (not \r\n as before) and getting rid of \r when it's there by terminating the string sooner. This should fix the issue in Safari, until they fix it on their end.
Nevermind that, I had to revert that change since it was causing crashes with the AudioBridge and VideoRoom plugins. My fault for not testing it exhaustively before committing... I'll investigate and in case, once fixed, I'll push again. For the time being, you'll have to fix the c-line in the SDP yourself in JavaScript before sending it to Janus.
if(jsep.sdp && jsep.sdp.indexOf("\r\na=ice-ufrag") === -1) {
jsep.sdp = jsep.sdp.replace("\na=ice-ufrag", "\r\na=ice-ufrag");
}
I've used this as a quick fix in meantime
Most helpful comment
FYI, I've submitted the issue on the webkit bug tracker: https://bugs.webkit.org/show_bug.cgi?id=203190