WebRTC: Use same SDP for multiple peer connections?

SET picture SET · Feb 14, 2014 · Viewed 7.6k times · Source

Is it possible to use same SDP in multiple peer connections?

I'm building video conference using WebRTC. The idea is that caller, using some signaling mechanism, send broadcast message to all other users with it's SDP (same SDP for each user) and then users will respond with their SDP.

When user receive somebody's SDP, he use it to set remote description, like this:

connection = new RTCPeerConnection()
desc = RTCSessionDescription({sdp: SDP, type: "offer"});
connection = setRemoteDescription(desc);

Here is SDP example:

v=0
o=- 6843023960119608301 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio
a=msid-semantic: WMS
m=audio 1 RTP/SAVPF 111 103 104 0 8 106 105 13 126
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:q36dZRVoaS4ixPYP
a=ice-pwd:K5yAm4A+zGoIKIgsX9o4VgDA
a=ice-options:google-ice
a=fingerprint:sha-256 62:3E:99:2F:FF:D4:58:7C:F0:A1:02:3F:09:2B:D1:F3:71:D7:F6:59:62:12:E4:1B:4A:68:01:4C:43:E0:D1:75
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=recvonly
a=rtcp-mux
a=crypto:0 AES_CM_128_HMAC_SHA1_32 inline:Tdz5Z3KHB3Xosqr5D53WZfi7Zndz+932X3H46Qvf
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:NJO4XhhHUgiJRCfyYzDgajkCJAF/9BX8QeU+FKQs
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:126 telephone-event/8000
a=maxptime:60

I don't see here anything unique, so if B and D will use it as remote description, would it work? If yes - how can I generate this SDP? The only way I know for now is using RTCPeerConnection.createOffer but this will create unneeded peer connection object (according to my idea, peer objects should be created after received response from other users).

Answer

Wilson Chen picture Wilson Chen · Feb 19, 2014

No, WebRTC is not designed that way. You need to create a separate PeerConnection for one peer.