Repository navigation
Releases
Releases · irbisadm/simple-sdp
v1.4.0
Fixes from running the library over public SDP sets; see "Checked against public SDP sets" in
the README.
Added
yarn check:externalruns the library over public collections and captures, downloaded into
.cache/. It is a manual check, not part of the tests or CI, and none of the data is in this
repository.
Fixed
sdpReader.parseaccepted anm=line with an empty media type, proto or non-RTP format
(m=audio 9 RTP/AVP 0gaveproto: ""and lost the codecs). It now throws
expected "<media> <port> <proto> <fmt> ...". Strict mode rejects input it used to accept.sdpReader.parseLenient: doubled spaces in a malformedm=line shifted the fields
(m=audio 9 RTP/AVP 0gaveproto: "9"and no port) or left''informats.sdpReader.isCompleteis false for a media section without formats (m=video 0 RTP/AVP),
whichsdpWriter.writerefuses.
v1.3.0
Added
- Lenient parsing:
sdpReader.parseLenient(text)never throws, keeps everything the text
allows and returns{sdp, warnings}. Each deviation thatparserejects becomes a
warning{code, reason, lineNumber, line, action}with the samereason(and, for the
first warning, the same line) as the strict error. Trailing spaces/tabs (except on
s=/i=/u=/e=/p=) and CR-only line endings are handled as well. New types
SdpLenient,SdpLenientMediaSection,SdpLenientResult,SdpParseWarning,
SdpParseWarningCode,SdpParseWarningAction, and the type guard
sdpReader.isComplete(sdp). See "Lenient parsing" in the README. sdpValidator.validate(text, {lenient: true})reports parse warnings as
lenient:<code>issues and checks the recovered model.SdpIssueCodenow includes the
lenient:*codes (a wider union type).- wasm:
sdp_parse_lenientandsdp_validate_lenient(C ABI),parseLenientand
validateLenient(ESM bindings);@irbisadm/simple-sdp/wasmhasparseLenient,
isCompleteand thelenientvalidator option. Swift:parseLenient(_:),
parseLenientJSON(_:),validateLenient(_:type:). Kotlin:parseLenient(sdp),
validateLenient(sdp, type).
Changed
sdpWriter.writeacceptsSdpLenientand throws for a media section withoutportor
proto(it used to writem=audio undefined …).- wasm: a model whose media section has no
portorprotois accepted bysdp_write
andsdp_validate_modellike in TypeScript (writing fails with the message above);
it used to fail with "invalid SDP model".
Fixed
- wasm: a description whose last line ends with a lone CR was parsed differently from
TypeScript (the CR was dropped); the strict parser now matches TypeScript. - A malformed
a=rtpmapno longer leaves a partially filled codec behind (not visible
throughparse, which throws, but used by lenient parsing).
v1.2.1-rc.1
Changed
- Releases are published to npm by CI (
release.yml) with npm trusted publishing, so
every version from now on carries an npm provenance attestation.
v1.2.0
Added
@irbisadm/simple-sdp/wasm: the same API and types as the main entry point, run by the
WebAssembly module (ESM with top-level await; works in Node.js and with bundlers that
handlenew URL(…, import.meta.url), checked with Vite 6). The module itself is
exported as@irbisadm/simple-sdp/wasm/simple-sdp.wasm.- Kotlin library on JitPack:
com.github.irbisadm:simple-sdp:v1.2.0(jitpack.yml). - GitHub Releases carry
simple-sdp.wasmfor other runtimes (.github/workflows/release.yml).
v1.0.1
Fixed
- Validator accepted malformed
a=fingerprintvalues such assha-256 AA:BB.
New issueinvalid-fingerprint(error) checks thata=fingerprintis colon-separated
hex pairs with the digest length of its hash function (md2/md5 16, sha-1 20, sha-224 28,
sha-256 32, sha-384 48, sha-512 64 bytes);fingerprint-not-uppercase(warning).
RFC 8122 §5. package.json:repositoryin the normalized object form (nonpm publishwarning).
Install: npm i @irbisadm/simple-sdp@1.0.1
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