Files
XC_VM/docs
Divarion_D ceca9f2df9 feat(streaming): P2/B — serve HLS from the daemon's in-RAM segmenter
Phase B (ADR 0003): HLS is now served from the xc_fanout daemon's in-RAM
HLS end-to-end for unencrypted streams, PHP doing only auth — the stepping
stone toward dropping the streaming tmpfs.

- live.php m3u8 branch: when the daemon is reachable, the stream is fed
  (isStreamFed) and encrypt_hls is off, fetch the daemon playlist
  (FanoutClient::hlsPlaylist → client socket) and tokenize its <seq>.ts
  entries (HLSGenerator::tokenizeDaemonPlaylist) into the same /hls/<token>
  auth'd URLs as the legacy path, with the segment marked <id>_d<seq>.ts.
  Else the legacy on-disk generateHLS runs (encrypted / daemon down).
- segment.php: a daemon-segment token runs the same uuid + IP checks, then
  X-Accel-Redirect: /xc_fanout_hls/<id>_<seq> → daemon /hls/<id>/<seq>.ts.
- nginx: internal location ^~ /xc_fanout_hls/ → proxy_pass daemon (two path
  segments, id_seq, to avoid the server-level rewrite hijack — same reason
  as /xc_fanout/ and /xc_hls/).

The daemon's HLS on-demand lifecycle was already closed (0.2.0 touch+reaper).
Box-validated: 569.m3u8 → daemon MEDIA-SEQUENCE + tokenized segments; a
segment fetch → 200 valid TS (953 KB) from the daemon's RAM. PHPStan clean.

Limitation: daemon HLS is plain mpegts → unencrypted streams only; encrypted
streams stay on legacy tmpfs HLS. Daemon-side encryption + removing the tee's
on-disk HLS slave are what Phase F needs to drop the tmpfs.

Refs ADR 0003 (Phase B).
2026-08-16 18:56:04 +03:00
..