microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
908 stars 282 forks source link

Help getting in band data channel to negotiate with Janus #602

Closed rygo6-MS closed 3 years ago

rygo6-MS commented 3 years ago

I am trying to get MRWebRTC to negotiate a data channel to Janus WebRTC Gateway.

Currently my Janus server negotiates media and data from SimplePeer without issue. Janus reports this in its log, stating the media and data channels have been negotiated successfully.

The negotiation from MRWebRTC ends up successfully establishing the video and audio. But, Janus does not report the data channel negotiated successfully, and the Peer.DataChannelAdded callback is never fired from MRWebRTC .

Comparing these two sources, the only thing I notice is that the data channel SDP going to MRWebRTC looks like this: a=sctpmap:5000 webrtc-datachannel 1024 Where as the data channel sdp going to SimplePeer looks like this: m=application 9 UDP/DTLS/SCTP webrtc-datachannel

Janus also reports that SimplePeer is using what it calls "new-datachan-sdp", whereas MRWebRTC is not. Looking into this it looks like the sdp format for data channels changed a few years ago.

Is the issue with MRWebRTC related to Janus trying to use the 'old' data channel SDP? Does MRWebRTC not support the old format?

Or am I missing something else here? I assume if I am trying to negotiate an in-band data channel, then when the data channel is created it should just be created on the MRWebRTC side, and Peer.DataChannelAdded should be called, is that correct? Or is there some additional set up I need to do on the MRWebRTC side.

djee-ms commented 3 years ago

I don't know of any old/new data channel. MixedReality-WebRTC via Google's WebRTC (m71) uses m=application. If you don't see this in the SDP offer/answer then the data channel was not negotiated correctly.

a=sctpmap is an additional attribute; that alone does not define a data channel. It should always be accompanied with an m=application line preceding it. https://stackoverflow.com/questions/31666531/understanding-sdp-generated-by-webrtc

rygo6-MS commented 3 years ago

Found the solution. For future seekers. MRWebRTC can negotiate both SDP formats of data channels just. This was a nuance of WebRTC backend Janus. It was designed to not open in-band data channels on connecting clients unless the client has a data channel already added by itself.

zhuisa commented 3 years ago

@rygo6-MS hi, I'm sorry to have bothered you. I also want to estalish Mixed-Reality-WebRTC with Janus, in order that I can establish one to more PeerConnection. But I don't kwon hao to do it. Can you give some help.