Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the m= line in sdp contain a port? Isn't this redundant with candidates?

Tags:

sdp

According to RFC 4566 https://www.rfc-editor.org/rfc/rfc4566#page-22, the m= line in an sdp contains a port:

m=audio 49170 RTP/AVP 0

Aren't ports determined by ICE candidates already? These contain ports as well:

a=candidate:1 1 UDP 2130706431 10.0.1.1 8998 typ host

As RFC 5245 https://www.rfc-editor.org/rfc/rfc5245#page-9 states,

"ICE is an extension to the offer/answer model, and works by including a multiplicity of IP addresses and ports in SDP offers and answers, which are then tested for connectivity by peer-to-peer connectivity checks."

Would that mean the port specified in the m= line is obsolete?

When using libjingle to create a new sdp offer, it shows an IP address of 0.0.0.0, together with port 9 (which is the "discard" port). So it obviously does not see the port in the m= line as relevant:

m=audio 9 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 106 105 13 127 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0

Does anybody know?

like image 796
Oliver Hausler Avatar asked Oct 14 '25 07:10

Oliver Hausler


1 Answers

IP and candidates in the m= line is a relict from pre-candidate eras, where fixed IPs and ports were used for communication.

At least with WebRTC, as specified in https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-jsep-15 on page 33,

"The port value is set to the port of the default ICE candidate for this m= section, but given that no candidates have yet been gathered, the "dummy" port value of 9 (Discard) MUST be used, as indicated in [I-D.ietf-ice-trickle], Section 5.1.", and

"The m= line MUST be followed immediately by a "c=" line, as specified in [RFC4566], Section 5.7. Again, as no candidates have yet been gathered, the "c=" line must contain the "dummy" value "IN IP4 0.0.0.0", as defined in [I-D.ietf-ice-trickle], Section 5.1.",

it is in simple words specified, that the m= line contains a dummy IP and port, as long as no candidates have been gathered and no media flow is desired, and the IP and port of the default candidate thereafter.

like image 144
Oliver Hausler Avatar answered Oct 18 '25 03:10

Oliver Hausler