Skip to content

librtmp2 0.15.0

Choose a tag to compare

@github-actions github-actions released this 20 Oct 22:49

Changed

  • Breaking (Rust API, not part of the extern "C" surface):
    ertmp::modex::modex_parse() / modex_write() now implement the E-RTMP v2
    ModEx framing (modExDataSize UI8/UI16+1, modExData, then one
    modExType:UB[4] | nextPacketType:UB[4] byte) instead of the fabricated
    0x80 | type marker layout with an eight-byte offset. ModexType::Timestamp
    is renamed to ModexType::TimestampOffsetNano (wire type 0, a UI24 offset in
    Modex::offset); a deprecated ModexType::Timestamp alias remains.
    Modex gains next_packet_type, modex_write() emits nothing for
    ModexType::Nop, and a new modex_parse_prefix() returns the consumed
    length. Framing is now shared with the live relay path
    (media::modex::parse_modex_layer), so there is a single ModEx parser.
    Struct-literal users of Modex need to set next_packet_type.
  • Breaking (Rust API, not part of the extern "C" surface):
    Server::new is now unsafe fn. It dereferences the raw
    ServerConfig::tls_cert_file / tls_key_file pointers as C strings, so its
    # Safety section now requires both to be NUL-terminated (valid UTF-8) or
    null when TLS is enabled. Safe Rust should use the new
    Server::from_config(config, tls: Option<(&Path, &Path)>), which takes TLS
    filesystem paths and never touches the raw pointer fields.
  • ServerConfig now implements Default (plaintext, null TLS pointers), and
    its TLS path fields document the NUL-termination requirement. The C ABI and
    the layout of lrtmp2_server_config_t are unchanged; the header comments now
    state the NUL-termination contract.

Security

  • Hardened enhanced-RTMP parsing and classification: video command and ModEx
    wrappers cannot bypass codec deny lists, video command frames are rejected as
    multitrack containers, malformed or empty AVC/HEVC and multitrack
    sequence-header records are rejected before caching, enhanced audio metadata
    is classified as critical, and the spec-legal empty Opus sequence-start
    payload remains cacheable. A changed sequence header drops the stale cached
    keyframe.
  • Hardened connection and send accounting: the TCP connect budget is split
    across resolved addresses, transmitted prefixes are drained from the send
    buffer after a failed blocking send, IPv6 literals keep their brackets in
    tcUrl and skip IP-literal SNI, and the active-CSID reassembly cap is O(1)
    instead of a per-chunk registry scan.
  • The raw Server constructor is now explicitly unsafe (see above); safe Rust
    uses Server::from_config and never dereferences caller-owned TLS pointers.

Fixed

  • Chunk parsing rejects a fmt=2 chunk that interrupts an in-flight message
    without consuming bytes, and abandoned relay-route/cache-eviction markers are
    bounded FIFOs that keep the newest route and drain displaced entries.
  • Session/auth handling re-arms the publish-media deadline after a same-route
    republish that follows real media, answers a withdrawn cross-role
    authorization request with a terminal onStatus, and releases superseded
    roles without leaving the peer waiting.
  • The client surfaces a server _error reply instead of waiting for the
    connect/publish timeout, and acknowledgement state tracks the Ack bytes
    rather than the whole send buffer, so flow control keeps working under
    backpressure.
  • Stream-cache pressure eviction skips co-tracked entries, the freeable-byte
    estimate matches the actual eviction rule, and reassembling transitions use
    the registry setter so the O(1) count cannot drift.
  • Public ModEx parsing/writing now shares the live E-RTMP v2 parser, and the
    exvideo_write path can round-trip the wrapper headers that exvideo_parse
    accepts.
  • Audio/video sequence-header validation covers malformed multitrack configs,
    and a VideoCommand frame is kept out of detected codec state.

Benchmarks

Measured automatically for this release on a CI runner; the machine is described below. Raw data: bench-results-v0.15.0.json.

  • Measured: 2026-10-20 22:51:35 UTC · 7d97b93 · crate version 0.15.0 · workflow run
  • CPU: AMD EPYC 7763 64-Core Processor · 4 vCPUs
  • RAM: 15.6 GiB
  • System: Linux 7.0.0-1017-azure x86_64 · rustc 1.99.1 · GitHub-hosted ubuntu24 (image 20261018.339.1)
  • Noise: shared CI VM — CPU model, neighbouring load and the runner image change between runs, so treat absolute numbers as indicative.
  • Comparable vs release v0.14.0: ⚠️ same CPU model and vCPU count, but rustc / kernel / runner image changed: differences under 10 % may come from the toolchain or host, not the code

protocol

Benchmark Time Throughput vs release v0.14.0
amf0_build_connect 261 ns — 🔴 +15.5 %
chunk/write_read_roundtrip 6.93 µs ~563 MiB/s ⚪ +0.9 %
flv/audio_tag_aac 1.26 ns — ⚪ +0.7 %
flv/video_tag_h264 1.25 ns — ⚪ +0.2 %
fourcc_to_video_codec_avc1 2.80 ns — 🔴 +12.4 %
server_read_c1 1.06 µs — ⚪ −0.3 %

relay

Benchmark Time Throughput vs release v0.14.0
relay/publish_to_player/100 96.9 ms ~1032 elem/s ⚪ +0.4 %
relay/publish_to_player/500 99.2 ms ~5038 elem/s ⚪ +1.0 %

🟢 faster · 🔴 slower · ⚪ within the noise band (5–25 % depending on how comparable the two environments are, plus both runs' Criterion confidence intervals). Lower time is better.