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).

有帮助吗?

解决方案

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

其他提示

You can use the same SDP, as long as it contains no Candidate fields! These candidate fields are bound to the local RTP Port, which is not reusable.

No, and if you find a way to get around this it is a very bad idea. The concept of a "connection" between two endpoints on the internet can really be broken down to a session negotiated between two points. This session may have fields that will be the same for each "connection", but other fields are unique for each peer. TCP was developed with creating basic connection sessions as part of it's specification. WebRTC allways communicates over UDP (even in the case when tunneled over TCP), and UDP has no concept of connections. WebRTC uses SDP in it's process of creating connection sessions, and SDP discovers/defines all needed fields per connection.

I think you are trying to develop multiple broadcast(from above diagram),Its possible to create multiple peer in webrtc(example if you want to broadcast your video two browser you need two peer connection means)

SDP:This protocol contain your browser information like your public ip,port,codec,and communication method means(Audio only,Video only,Data channel etc)

So the above information is common if you want to communicate other peer(because your public ip,Port,codec) same so its possible to share you sdp multiple peer (NOTE:you open new peer for each user)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top