SDP (RFC 8866) and WebRTC attributes

View Source

This page tracks the SDP codec: the RFC 8866 grammar and the attribute syntax WebRTC relies on (ICE, DTLS, SCTP, BUNDLE, RTP, simulcast). It covers parsing and encoding only. Offer/answer and JSEP rules (RFC 3264, RFC 9429, RFC 9143 §7) will be added as rows when webrtc_jsep lands.

Tests named name_test or name_test_ live in webrtc_sdp_tests, unless prefixed with another module. prop_* are PropEr properties in prop_webrtc_sdp.

Grammar (RFC 8866)

IDSectionRequirementModuleTestStatus
SDP-15Lines are <type>=<value> with a single lowercase type letter and no space around =webrtc_sdpmalformedtest (bad_line)Unit tested
SDP-25CRLF line ending; LF alone accepted on parse; CRLF always emittedwebrtc_sdplfonly_test, roundtriptestUnit tested
SDP-35Last line without terminator acceptedwebrtc_sdpmissing_final_newline_testUnit tested
SDP-45A type letter that is not understood rejects the descriptionwebrtc_sdpmalformedtest (unknown_field)Unit tested
SDP-55, 9Session field order and cardinality: v o s [i] [u] e p [c] b 1(t r [z]) [k] awebrtc_sdpmalformedtest, prop_random_linesUnit tested
SDP-65, 9Media field order and cardinality: m [i] c b [k] *awebrtc_sdpmalformedtestUnit tested
SDP-75Values contain no NUL, CR or LF (byte-string)webrtc_sdpmalformedtest (bad_character)Unit tested
SDP-85.1v=0webrtc_sdpmalformedtest (bad_version)Unit tested
SDP-95.2o= username, numeric sess-id and sess-version, nettype, addrtype, addresswebrtc_sdpchromeoffer_test, malformed_testUnit tested
SDP-105.2sess-id and sess-version kept as integerswebrtc_sdpprop_encode_parseNon-compliant / known limitation: leading zeros are dropped on encode.
SDP-115.3 to 5.6s=, i=, u=, e=, p=webrtc_sdprfc8866_example_testUnit tested
SDP-125.5, 5.6u=, e= and p= sub-grammars (RFC 3986, RFC 5322)webrtc_sdpNon-compliant / known limitation: kept as text, not validated beyond the line rules. An empty s= is accepted.
SDP-135.7c= nettype addrtype connection-address, multicast /ttl/numaddr kept as writtenwebrtc_sdprfc8866_example_testUnit tested
SDP-145.7c= present at session level or in every media descriptionNot implemented: not enforced by the parser, left to JSEP.
SDP-155.8b= bwtype : bandwidth (AS, TIAS, ...)webrtc_sdpicelite_answer_test, malformed_testUnit tested
SDP-165.9t= start and stop are 0 or at least 10 digitswebrtc_sdprfc8866example_test, malformed_testUnit tested
SDP-175.10, 5.11r= repeat interval and typed times, z= adjustments with optional -webrtc_sdprfc8866_example_test, prop_encode_parseUnit tested. A z= line right after t= (RFC 4566 placement) is also accepted.
SDP-185.12k= prompt, clear, base64, uriwebrtc_sdprfc8866example_test, malformed_testUnit tested
SDP-195.13a= attribute-name token with optional value; unknown attributes kept in orderwebrtc_sdp_attrrfc8866_example_test, misc_attributes_testUnit tested
SDP-205.14m= media, port 0 to 65535, optional /count, proto token *("/" token), at least one fmtwebrtc_sdpmalformedtest (bad_media, bad_port, bad_proto)Unit tested
SDP-216.4, 6.5, 6.13ptime, maxptime, framerate as non-zero-int-or-realwebrtc_sdp_attrrfc8866_example_test, simulcast_paused_testUnit tested
SDP-226.7Direction attributes; default sendrecv; session level applies to mediawebrtc_sdp_mediachrome_answer_test, rfc8866_example_testUnit tested
SDP-236.6rtpmap payload type 0 to 127, encoding name, clock rate, optional channelswebrtc_sdp_rtpchromeoffer_test, malformed_testUnit tested
SDP-246.15fmtp format and parameters; parameters split on ;; received text kept and written back when unchangedwebrtc_sdp_rtpfmtp_raw_preserved_test, firefox_offer_testUnit tested
SDP-256.10charset attributeNon-compliant / known limitation: text is handled as bytes, charset is not interpreted.
SDP-26encode(parse(X)) is byte exact for CRLF input written in canonical formwebrtc_sdproundtriptestUnit tested. Lowercase fingerprint hex, upper-case hash names and leading zeros are rewritten in canonical form.
SDP-27parse(encode(R)) =:= {ok, R} for any valid recordwebrtc_sdpprop_encode_parseUnit tested
SDP-28Encoder refuses values that would break the line structure (CR, LF, NUL, separators)webrtc_sdpencode_rejects_line_injection_testUnit tested
SDP-29Malformed, truncated or random input returns {error, {Line, Reason}} and never raiseswebrtc_sdptruncationtest, prop_random_bytes, prop_mutated_sample, prop_random_attributeUnit tested

ICE attributes (RFC 8839 §5, RFC 8840, RFC 6544)

IDSectionRequirementModuleTestStatus
SDP-ICE-18839 5.1candidate: foundation 1*32 ice-char, component 1 to 256, transport token, priority 1 to 2^31-1, address, port, typ host/srflx/prflx/relay or tokenwebrtc_sdp_candidatewebrtcsdp_candidate_tests:errors_test, roundtriptestUnit tested
SDP-ICE-28839 5.1raddr and rport in position, other extension attributes kept in orderwebrtc_sdp_candidatewebrtc_sdp_candidate_tests:fields_test, trickle_candidates_testUnit tested
SDP-ICE-38839 5.1IPv6 selected by the presence of a colon; IPv4 and IPv6 parsed strictlywebrtc_sdp_candidatetricklecandidates_test, webrtc_sdp_candidate_tests:errors_testUnit tested
SDP-ICE-48839 5.1FQDN and mDNS .local addresses kept as nameswebrtc_sdp_candidatetrickle_candidates_test, webrtc_sdp_candidate_tests:mdns_testUnit tested. The transport resolves the names (ice.md SDP-3, MDNS-1).
SDP-ICE-56544 4.5tcptype active/passive/sowebrtc_sdp_candidateicelite_answer_test, webrtc_sdp_candidate_tests:roundtrip_testUnit tested
SDP-ICE-68840Standalone candidate: value for trickle signalingwebrtc_sdp_candidatewebrtc_sdp_candidate_tests:forms_test, prop_candidate_roundtripUnit tested
SDP-ICE-78840end-of-candidateswebrtc_sdp_attrtrickle_candidates_test, pion_answer_testUnit tested
SDP-ICE-88839 5.3ice-lite (session) and ice-mismatch (media)webrtc_sdp_attrice_lite_answer_test, misc_attributes_testUnit tested
SDP-ICE-98839 5.4ice-ufrag 4 to 256 and ice-pwd 22 to 256 ice-charwebrtc_sdp_attrmalformedtestUnit tested
SDP-ICE-108839 5.4Media-level ice-ufrag/ice-pwd take precedence over session levelwebrtc_sdp_mediaattribute_helpers_testUnit tested
SDP-ICE-118839 5.6ice-options tags (trickle, ice2, renomination), media level over session levelwebrtc_sdp_attrtrickle_candidates_testUnit tested
SDP-ICE-128839 5.2remote-candidatesNot implemented: kept as an untyped attribute.
SDP-ICE-138839 5.5ice-pacing: session level, 1*10DIGIT, 50 ms when absentwebrtc_sdp_attr, webrtc_sdp_mediamalformedtest, ice_pacing_test, prop_random_attributeUnit tested

DTLS attributes (RFC 8122, RFC 8842, RFC 4145)

IDSectionRequirementModuleTestStatus
SDP-DTLS-18122 5fingerprint: hash-func SP 2HEX *(":" 2HEX), value decoded to byteswebrtc_sdp_attrchromeoffer_test, malformed_testUnit tested
SDP-DTLS-28122 5Digest length matches the hash function (sha-1 to sha-512, md5, md2)webrtc_sdp_attricelite_answer_test, malformed_testUnit tested
SDP-DTLS-38122 5Upper-case hexwebrtc_sdp_attrmisc_attributes_testUnit tested. Lowercase hex and hash names are accepted on input and written canonically.
SDP-DTLS-48122 5.1Several fingerprints per section, in orderwebrtc_sdp_attrmisc_attributes_testUnit tested
SDP-DTLS-58122 5Session-level fingerprint applies when the section has nonewebrtc_sdp_mediafirefox_offer_test, pion_answer_testUnit tested
SDP-DTLS-64145 4setup actpass/active/passive/holdconn, media level over session levelwebrtc_sdp_attr, webrtc_sdp_mediachromeanswer_test, malformed_testUnit tested. An absent setup is reported, not defaulted (RFC 8842 requires it).
SDP-DTLS-78842 4tls-id 20 to 255 tls-id-charwebrtc_sdp_attrrfc8866example_test, malformed_testUnit tested
SDP-DTLS-84145 5connection new/existingwebrtc_sdp_attrrfc8866_example_testUnit tested

SCTP attributes (RFC 8841)

IDSectionRequirementModuleTestStatus
SDP-SCTP-14m=application proto (UDP/DTLS/SCTP, TCP/DTLS/SCTP) and fmt webrtc-datachannel kept as writtenwebrtc_sdpchrome_offer_testUnit tested
SDP-SCTP-25sctp-port 0 to 65535webrtc_sdp_attrchromeoffer_test, malformed_testUnit tested
SDP-SCTP-36max-message-size 1*DIGITwebrtc_sdp_attrfirefoxoffer_test, malformed_testUnit tested
SDP-SCTP-45, 6No leading zeroswebrtc_sdp_attrNon-compliant / known limitation: accepted on parse, never emitted.
SDP-SCTP-5Legacy sctpmap (draft-ietf-mmusic-sctp-sdp-05) with DTLS/SCTPwebrtc_sdp_attrfirefox_legacy_datachannel_testUnit tested. Parsed for interop, JSEP is not expected to generate it.

BUNDLE and grouping (RFC 9143, RFC 5888)

IDSectionRequirementModuleTestStatus
SDP-BUNDLE-15888 5group semantics *(SP identification-tag)webrtc_sdp_attrchromeoffer_test, malformed_testUnit tested
SDP-BUNDLE-25888 4mid tokenwebrtc_sdp_attrchromeoffer_test, malformed_testUnit tested
SDP-BUNDLE-39143 6bundle-onlywebrtc_sdp_attrmisc_attributes_testUnit tested
SDP-BUNDLE-45888 4mid unique within a descriptionwebrtc_jsepwebrtc_jsep_tests:duplicate_mid_testUnit tested: a description with a repeated mid is refused (duplicate_mid)

RTP attributes

IDSectionRequirementModuleTestStatus
SDP-RTP-14585 4.2rtcp-fb payload type or *, feedback type and parameterswebrtc_sdp_rtpchrome_offer_test, misc_attributes_testUnit tested
SDP-RTP-24585 4.2Wildcard feedback applies to every payload typewebrtc_sdp_mediasimulcast_paused_testUnit tested
SDP-RTP-38285 8extmap id 1 to 255 or 4096 to 4351, optional direction, URI, extension attributeswebrtc_sdp_rtpfirefoxoffer_test, ice_lite_answer_test, malformed_testUnit tested
SDP-RTP-48285 6extmap-allow-mixedwebrtc_sdp_attrchrome_offer_testUnit tested
SDP-RTP-55761, 8858rtcp-mux, rtcp-mux-onlywebrtc_sdp_attrsimulcast_paused_testUnit tested
SDP-RTP-65506rtcp-rsizewebrtc_sdp_attrchrome_offer_testUnit tested
SDP-RTP-73605 2.1rtcp port with optional addresswebrtc_sdp_attrchromeoffer_test, malformed_testUnit tested
SDP-RTP-88830 2msid id and optional appdata, 1 to 64 token-char eachwebrtc_sdp_rtpchromeoffer_test, malformed_testUnit tested
SDP-RTP-9Legacy msid-semantic (WMS), text kept as receivedwebrtc_sdp_rtpchrome_answer_test, firefox_offer_testUnit tested
SDP-RTP-105576 4.1ssrc id 0 to 2^32-1 with attribute[:value]webrtc_sdp_rtpchrome_offer_test, pion_answer_testUnit tested
SDP-RTP-115576 4.2ssrc-group semantics (FID, SIM, FEC-FR, ...) and ssrc listwebrtc_sdp_rtpchrome_offer_test, firefox_offer_testUnit tested
SDP-RTP-125576 6.2previous-ssrcNot implemented: kept as an untyped attribute.
SDP-RTP-133551 6Static payload types used when rtpmap is absentwebrtc_sdp_mediarfc8866_example_testUnit tested

RID and simulcast (RFC 8851, RFC 8853)

IDSectionRequirementModuleTestStatus
SDP-RID-18851 4, 10rid id, send/recv, optional pt= list and restrictionswebrtc_sdp_ridfirefoxoffer_test, simulcast_paused_test, malformed_testUnit tested
SDP-RID-28851 4, 10depend restriction is a rid-id listwebrtc_sdp_ridsimulcastpaused_test, malformed_testUnit tested
SDP-RID-38851 4, 10Value grammar of known restrictions (int and float values)webrtc_sdp_ridNon-compliant / known limitation: only the generic param-val grammar is checked; values are kept as text.
SDP-SC-18853 5.1simulcast send and/or recv, streams separated by ;, alternatives by ,webrtc_sdp_ridsimulcast_paused_test, firefox_offer_testUnit tested
SDP-SC-28853 5.1Paused streams (~)webrtc_sdp_ridsimulcast_paused_testUnit tested
SDP-SC-3Draft syntax (a=simulcast: send rid=...) of old FirefoxNon-compliant / known limitation: rejected as a malformed attribute.
SDP-RID-48851 6.2.2 step 1A malformed a=rid line is discarded, not the descriptionwebrtc_sdpmalformedtestNon-compliant / known limitation: the parser rejects the whole description.

Other attributes

IDSectionRequirementModuleTestStatus
SDP-MISC-18827 5identity assertion (base64) and extensions, parse onlywebrtc_sdp_attrmisc_attributes_testUnit tested
SDP-MISC-24574label tokenwebrtc_sdp_attrrfc8866_example_testUnit tested
SDP-MISC-34796content comma-separated listwebrtc_sdp_attrrfc8866_example_testUnit tested

Helpers for JSEP

IDSectionRequirementModuleTestStatus
SDP-API-1Codecs of a section merging rtpmap, fmtp and rtcp-fb, and the inversewebrtc_sdp_mediacodecsinverse_test, codec_attributes_order_testUnit tested
SDP-API-2Attribute lookup at media level with session-level fallbackwebrtc_sdp_mediaattribute_helpers_testUnit tested

JSEP (RFC 9429), offer/answer (RFC 3264), BUNDLE (RFC 9143)

IDSpecRequirementModuleTestStatus
JSEP-19429 §3.2Signaling state machine, invalid transitions refusedwebrtc_jsepinvalid_states_testUnit tested
JSEP-29429 §4.1.10.2, §5.7Rollback in every state but stable (offers and provisional answers), same effect through either setter; restores transceivers, DTLS role, tls-id and ICE credentials; remote rollback removes transceivers created by the offer; a rolled back remote ICE restart never reaches the transportwebrtc_jsep, webrtc_pcglare_rollback_test, remote_rollback_removes_created_transceivers_test, pranswer_rollback_test, ice_restart_rollback_test, webrtc_pc_SUITE:remote_ice_restart_rolled_backE2E tested
JSEP-39429 §4.1.10.1pranswer in both directions; the transport is configured with the provisional answer (connection and data flow before the final answer) unless it carries an ICE restart, which waits for the final answerwebrtc_jsep, webrtc_pcpranswer_test, webrtc_pc_SUITE:pranswer_connectsE2E tested
JSEP-49429 §5.2.1Offer: mid per m= section, BUNDLE group, rtcp-mux, rtcp-rsize, ice-options trickle, fingerprint, setup actpasswebrtc_jsep_buildbasic_testUnit tested
JSEP-59429 §5.2.2Subsequent offers keep m= section order and midswebrtc_jsep_buildrenegotiation_keeps_order_and_role_testUnit tested
JSEP-69429 §5.2.2Stopped transceiver rejected with port 0 and removed from BUNDLEwebrtc_jsep_buildstop_transceiver_testUnit tested
JSEP-79429 §5.3.1Answer: one m= section per offered section, same order and midswebrtc_jsep_buildbrowseroffer_testUnit tested
JSEP-83264 §6.1Direction negotiationwebrtc_jsep_builddirectionstestUnit tested
JSEP-93264 §6.1Codec intersection with the offerer's payload types; rtx follows its aptwebrtc_jsep_capscodec_intersection_test, rtx_follows_primary_testUnit tested
JSEP-103264 §6No common codec: section rejectedwebrtc_jsep_buildno_common_codec_rejects_section_testUnit tested
JSEP-119429 §5.10Transceiver association, recvonly transceivers created for unmatched offered sectionswebrtc_jsepanswer_creates_recvonly_transceiver_testUnit tested
JSEP-129429 §5.8Every remote description: at least one active section, unique mids, no mid in two BUNDLE groups, and per active section ICE credentials, a fingerprint, a=setup other than holdconn, rtcp-mux for RTP, simulcast rids declaredwebrtc_jsepvalidationtestUnit tested
JSEP-289429 §5.8.3, 3264 §6Answers and pranswers: the offer's m= sections in order with the same mid, media type and protocol; active sections choose active or passive, keep the established DTLS role unless the association is replaced, use a direction the offer allows and only offered payload types for the same codecswebrtc_jsepanswervalidation_test, answer_keeps_dtls_role_testUnit tested
JSEP-299429 §5.8.3, §5.2.2Re-offers keep every current m= section in place with its mid and media type; only rejected sections are reusedwebrtc_jsepreoffervalidation_testUnit tested
JSEP-308285 §6Header extensions used for sending are the ones both descriptions list; rtcp-fb limited to the local capabilitieswebrtc_jsep_params, webrtc_jsep_capsanswer_extensions_filtered_testUnit tested
JSEP-138842 §5.3, §5.5Answer setup active; established DTLS role kept on renegotiationwebrtc_jsep, webrtc_jsep_buildbasic_test, renegotiation_keeps_order_and_role_testUnit tested
JSEP-149429 §5.2.1, 8445 §9ICE restart with new credentialswebrtc_jsepice_restart_testUnit tested
JSEP-158285 §5Header extension ids from the offer reused in the answerwebrtc_jsep_capsbasic_testUnit tested
JSEP-169143 §7.3, 9429 §5.2.1, §5.2.2Several transports per peer connection: unbundled m= sections and several BUNDLE groups, offered (bundle => false) and answered; later offers keep the transports of the last answer, new sections join the first BUNDLE group; an answer bundling what the offer did not is refusedwebrtc_jsep, webrtc_jsep_transport, webrtc_pcunbundled_offer_test, two_bundle_groups_test, unbundled_local_offer_test, answer_adds_bundle_refused_test, webrtc_jsep_transport_tests, webrtc_pc_SUITE:unbundled, webrtc_pc_interop_SUITE:erlang_offers_unbundledInteroperability tested (Chromium, Firefox)
JSEP-178841 §6max-message-size defaults to 64 KiB when absentwebrtc_jsepImplemented, untested
JSEP-189429 §5.2.1Offer: one a=rid send line per encoding and a=simulcast:send with several, only when sending; rids from the application or generated from a counter; the same lines in later offerswebrtc_jsep_simulcastwebrtc_jsep_simulcast_tests:offer_test, not_sending_no_rid_lines_test, reoffer_keeps_rid_lines_test, encodings_testUnit tested
JSEP-209429 §5.8.3rid-ids of a=simulcast exist as a=rid lines, otherwise the description is refusedwebrtc_jsepwebrtc_jsep_simulcast_tests:unknown_simulcast_rid_rejected_testUnit tested
JSEP-218851 §6.2.2, §6.3Answer to offered send rids: duplicated rid-ids discarded, pt= reduced to answered formats (line dropped when none is left, no pt= added), unknown depend discarded, direction reversed, restrictions and rid-ids keptwebrtc_jsep_simulcastwebrtc_jsep_simulcast_tests:discarded_rid_lines_test, restrictions_alternatives_and_paused_testUnit tested. Restrictions are not checked against codec parameters (§6.2.2 step 6, §8).
JSEP-228853 §5.3.2Answer: a=simulcast:recv with the kept rid-ids and alternatives, never more streams; several a=simulcast lines disable simulcast; no stream marked pausedwebrtc_jsep_simulcastwebrtc_jsep_simulcast_tests:chrome_simulcast_answer_test, firefox_simulcast_answer_test, two_simulcast_lines_disable_simulcast_test, restrictions_alternatives_and_paused_testUnit tested. RTP pause/resume (RFC 7728) is not implemented, so the offer's ~ marks are reported in recv_rids (paused) but not repeated.
JSEP-238851 §6.4Offerer: answer rid lines with new restrictions, less restrictive values or a pt= the offer did not have are discarded; pt= lists compared by codecwebrtc_jsep_simulcastwebrtcjsep_simulcast_tests:answer_restrictions_testUnit tested
JSEP-248853 §5.3.3, 9429 §3.7Offerer: rids removed by the answer are not sent; without a=simulcast in the answer only the first encoding is sent; pause marks of the answer reportedwebrtc_jsep_simulcastwebrtc_jsep_simulcast_tests:answer_removes_and_pauses_layers_test, answer_without_simulcast_testUnit tested
JSEP-259429 §5.9, 8852Layers are negotiated only with the RtpStreamId header extension, and exposed as send_rids / recv_rids in negotiated/1webrtc_jsep_simulcastwebrtc_jsep_simulcast_tests:no_rid_extension_no_layers_test, erlang_to_erlang_layers_testUnit tested
JSEP-269429 §5.10, 8853 §5.3Sending simulcast in an answer: a transceiver without encodings takes the layers of an offer with a=rid recv and a=simulcast:recv, answered with send rids and a=simulcast:send, layers the offer marks paused start paused; recv_rids offers to receive layerswebrtc_jsep_simulcastwebrtc_jsep_simulcast_tests:answerer_sends_layers_test, answerer_layers_kept_test, webrtc_pc_SUITE:simulcast_answerer, webrtc_pc_interop_SUITE:erlang_receives_simulcastInteroperability tested (Firefox sends the layers)
JSEP-197874, 7742Mandatory codecs offered: Opus, PCMU, PCMA, VP8, H.264 constrained baselinewebrtc_jsep_capsbasic_testUnit tested (negotiation only; payloads are forwarded, not decoded)
JSEP-279143 §6, 9429 §5.2.1A bundle-only m= section (port 0 and a=bundle-only) of a BUNDLE group is accepted, answered with the bundle port and without bundle-onlywebrtc_jsep (bundle_view/1)bundle_only_section_accepted_test, port_zero_without_bundle_only_rejected_test, webrtc_pc_interop_SUITE firefox groupInteroperability tested