Fix broken EchoTest demo for Firefox if datachannels are not supported #2281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was recently made aware that if you try to open the EchoTest demo with Firefox on a Janus that has been build without support for datachannels, the PeerConnection setup fails. I'm just mentioning the EchoTest here and in the commit/title for the sake of simplicity, but this actually is true for all PeerConnections where Firefox offers data channels and Janus doesn't support them (e.g., VideoRoom publishers sending data too). The cause is how we create the m-line to reject the media:
which causes this error to appear on the Firefox JS console:
It all works as expected in Chrome instead (haven't tried Safari, Edge, or mobile browsers).
This patch tries to address that, by ensuring that we always add the
webrtc-datachannel
format to the m-line even when we're rejecting the SDP, i.e.:This seems to fix the broken PeerConnection in Firefox, and still works in Chrome, so I consider the issue fixed. I decided to push this as a pull request just in case you can find cases where this actually breaks something it shouldn't (as I mentioned, I didn't test extensively, also because I don't have access to some browsers at all). I plan to merge soon, though, so please notice I won't wait forever.