Skip to content

feat(stream): automatic bitrate on the page - #66

Merged
enricobuehler merged 1 commit into
mainfrom
feat/web-abr
Oct 30, 2026
Merged

enricobuehler merged 1 commit into
mainfrom
feat/web-abr

Conversation

@enricobuehler

Copy link
Copy Markdown
Member

Design: web-client-tcp-bridge.md §7 (decision D12).

The page streamed at the rate the host resolved and never moved it. Now core's ABR driver runs on the page, fed through punktfunk_core::abr::feed the way the native pump feeds it. Everything lives in packages/stream/rust/abr.rs; session.rs calls in at the Welcome, per access unit, per control frame (BitrateChanged, accepted Reconfigured) and per pump.

  • ClientHello.abr_features = EXT_ABR_ACK_REASON. Acks go into the next tick, and the driver's SetBitrate goes out on the control stream.
  • Inputs: Session::stats, loss positions, shard delays (drained only), this session's ring drops, decode time from pf_hud_decoded, host encode time and timings from 0xCF, recovery keyframe asks.
  • No clock offset (clock_offset_ns: 0), so no one-way-delay signal. Every Probe goes back as on_probe_dropped. Report/Shape/LinkRate ride Feedback levels the page does not send yet. Loss and acks drive it.
  • FLAG_PROBE frames never reach the decoder now (there was no guard before).
  • The overlay gets the driver's target, Automatic, and the last cut reason.

Pin note. This builds against monorepo branch refactor/abr-feed (local, unpushed). The punktfunk-core pin in packages/stream/Cargo.toml must be bumped to a rev that includes it before this merges, so CI's wasm job fails until then.

stream_cap_kbps calls core's abr::stream_ceiling_kbps, exported by monorepo commit 45b4b1b11 on refactor/abr-feed (the same branch this pin bump needs).

Checked locally against that branch through a path patch (not committed): cargo fmt --check, cargo clippy (host and wasm, -D warnings), cargo test (21 pass, 2 new), build.sh links, npm test and npm run check unchanged.

Replaces #65, which GitHub closed when its stacked base branch was deleted by #64's merge; same commit.

The page streamed at the rate the host resolved and never moved it.

The driver is core's, fed through `abr::feed` the way the native pump
feeds it: the session's counters, loss positions, ring drops, decode and
host encode times, keyframe asks and the host's bitrate acks. Its rate
asks go out as `SetBitrate`. The stream ceiling is core's too.

No clock offset is measured and no probe is asked for yet, so loss and
acks drive it.
@enricobuehler
enricobuehler merged commit 27aa33c into main Oct 30, 2026
6 checks passed
@enricobuehler
enricobuehler deleted the feat/web-abr branch October 30, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant