webrtc icon indicating copy to clipboard operation
webrtc copied to clipboard

Assign mid to creaeSDPOffer

Open lisay-yan opened this issue 1 year ago • 1 comments

Summary

Based on https://github.com/pion/webrtc/issues/879 It is force setSDPRemote with mid, then suppose when new local SDP, the mid should be kept. BTW, can I know Pion take mid as mandatory due to correlate RTP sender/receiver?

Then, go to my new request. Is it possible pass mid value when createSDPOffer??

Motivation

In Telecommunications industry, maybe audio/video/application m lines received at incoming SIP, such as: m=video mid=0 m=audio mid=1 m=application 9 UDP/DTLS/SCTP webrtc-datachannel mid =2

So, peerConn is only for webrtc-datachannel with mid=2, Pion is great to give SDP answer for the received mid=2. While, if request a totally new SDP Offer for outgoing side, Pion generated offer will merged with audio/video together at call processing, currently, it is default start mid since 0, while, as above sdp example show, mid=0 and mid=1 had been used by audio/video lines. I prefer pass mid=3 to the SDP Offer to prevent duplicate mid in while SIP/SDP negotiation.

Describe alternatives you've considered

In peerconnection.go if pc.sctpTransport.dataChannelsRequested != 0 { mediaSections = append(mediaSections, mediaSection{id: strconv.Itoa(len(mediaSections)), data: true}) }

if createOffer not pass mid, keep 0. if createOffer pass mid, use the mid to customize it per user needs.

Additional context

Pion is work well for below case. UE1 ----Offer ----->WEBRTC Media UE1 <----Answer ----->WEBRTC Media

Request Pion enhanced for below case: WEBRTC Media(Pion) ----Offer (with specific mid) ----> UE2 WEBRTC Media <----Answer ---------------- ----> UE2

lisay-yan avatar May 24 '23 08:05 lisay-yan

This is a great API suggestion @lisay-yan I would be happy to add it!

We could put it in the SettingEngine maybe? Tell me what I can do to help here

Sean-Der avatar Apr 02 '24 18:04 Sean-Der