Repository navigation
v1.0.0
The model of 0.2.0 is now the stable 1.x API. No breaking changes since 0.2.0.
Added
sdpWriter.write(sdp): string. Lines are written in RFC 8866 §5 order with CRLF;
attribute order inside a section is normalized (see README, "Writing"). Round-trip
tests cover every fixture.sdpValidator.validate(sdp | text, {type?}): SdpIssue[], plus typesSdpIssue,
SdpIssueCodeandSdpValidateOptions(rules: README, "Validation").package.json: anexportsmap withtypesandsideEffects: false.
Included from 0.2.0 (never published separately)
Parser rewrite: strict RFC 8866, a lossless model, typed WebRTC attributes. Breaking.
Fixed
- Time unit
hinr=/t=/z=is 3600 s, not 86400 s (RFC 8866 §5.10). a=sendonly,a=recvonlyanda=inactivewere not recognized as directions
(onlysendrecvwas).r=: active duration was read from the repeat-interval field, and offsets were dropped
unless the line had more than three fields.b=:bwtypecontained theb=prefix ("b=AS").u=overwrotei=instead of being stored asuri.- Media-level
i=,b=andk=overwrote the session-level fields. a=rtcp-fbkept only its first token (nack pli→nack).a=groupwith semantics other than the seven built-in ones was silently dropped.
Added
SdpParseError(lineNumber,line,reason). It is thrown for malformed lines,
unknown line types, line order violations (RFC 8866 §5), missingv=/o=/s=/t=
and malformed typed attributes.z=(time zone adjustments), multipleb=/e=/p=lines, LF-only line endings.- Typed attributes:
a=candidate(RFC 8839),a=end-of-candidates(RFC 8840),a=ice-lite,
a=ssrc/a=ssrc-group(RFC 5576),a=msid(RFC 8830),a=rid(RFC 8851),
a=simulcast(RFC 8853),a=rtcp-mux(RFC 5761),a=rtcp-rsize(RFC 5506),
a=extmap-allow-mixed(RFC 8285),a=rtcp(RFC 3605),a=sctp-portand
a=max-message-size(RFC 8841). Thea=extmapdirection and extension attributes
are now kept as well. - A known attribute outside its scope (e.g.
a=midat session level), orrtpmap/fmtp/rtcp-fb
for a payload type missing fromm=, is kept inattributesinstead of being lost. - Test fixtures: real SDP from Chrome 156, Firefox 159, Chrome (2023) and SIP devices.
Changed (migration from 0.1.x)
| 0.1.x | 0.2.0 |
|---|---|
protocolVersion?, origin?, sessionName?, timing?, media? |
required (always present after parsing) |
origin.sessVersion: number |
string (like sessId; 64-bit values exist) |
origin.netType: 'IN', addrType: 'IP4' | 'IP6' (others became undefined) |
string, kept verbatim |
repeat[] (session level) |
timing[i].repeat[] (belongs to its t=) |
emailAddress, phoneNumber |
emailAddresses[], phoneNumbers[] |
encryptionKeys[] |
encryptionKey (at most one per level) |
bandwidthInformation |
bandwidths[] |
ice.ufrag / ice.pwd / ice.options |
iceUfrag / icePwd / iceOptions |
dtls.algorithm + dtls.fingerprint |
fingerprints[]: {hashFunction, fingerprint} |
dtls.setup (defaulted to actpass when absent) |
setup (absent when absent) |
group[].token |
group[].semantics |
media[].ports: number[] |
port, numberOfPorts? |
media[].fmt[] (contentType: 'opus/48000/2', formatParameters) |
codecs[] (encodingName, clockRate, encodingParameters, parameters, rtcpFeedback) |
fmtp parameter without value → 'unknown' |
null |
media[].fmtp[] / media[].description (non-RTP) |
formats[] |
extmap: Record<number, string> |
extmap: SdpExtmap[] |
msid?: {streamId, trackId} |
msid?: SdpMsid[] |
attributes: Record<string, string | true | string[]> |
attributes: {name, value?}[] in original order |
types SdpAVMediaSection, SdpAppMediaSection, SdpOtherMediaSection |
SdpMediaSection |
types SdpAttribute, SdpIceAttributes, SdpDtlsAttribute |
SdpGenericAttribute, flat fields |
invalid input sometimes produced NaN or partial objects |
SdpParseError |
Upgrading from 0.1.x: the model changed, see the migration table above.
Install: npm i @irbisadm/simple-sdp@1.0.0