fix(cctv): keep an HLS camera's health through the refused viewer's frame

A viewer refused for capacity falls back to /frame after hls.js gives up.
For a pullable HLS camera without a snapshot, /frame only has a
placeholder or a Street View frame, which says nothing about the stream,
yet it wrote degraded over the health that /media owns. /frame now
leaves that health as it is; a dead upstream is still reported through
/media.

Tests: the middleware suite covers both fallbacks, a real upstream
failure that still degrades, and cross-site segment and release refusals
on a live HLS lease; capacity checks use HLS_LIMITS and HlsCapacityError;
the three CCTV suites share one provider harness in src/testSupport.
CURRENT-STATE and the changelog fragment describe the refusal.
This commit is contained in:
German Khokhlov committed 2026-11-20 11:48:22 +04:00
1 parent f5f5f04b5d
commit ed38a1ab3f
10 files changed
+283 -321

No files matched your search

+4 -1
View File
@@ -9582,7 +9582,10 @@ its paint loop. Camera deactivation destroys the decoder, and fatal playback
errors revert to the labeled frame fallback. Camera changes clear the old panel
frame. hls.js is imported only when an HLS camera starts. Two live sessions may
coexist with at most eight independent consumer leases each; no-access lease
expiry is 15 seconds. Closing one consumer leaves other consumers running. Lease
expiry is 15 seconds. A viewer refused because every lease or session slot is
taken gets 503 with `Retry-After: 2` and leaves the camera's health unchanged;
so does its frame fallback, since an HLS camera without a snapshot has no frame
of its own. Closing one consumer leaves other consumers running. Lease
ids use `crypto.randomUUID` where the page is a secure context and an equivalent
v4 id from `crypto.getRandomValues` on plain-HTTP LAN pages. Encrypted/fMP4/byte-range playlists fail
closed. Performance and live agency reliability require recorded validation.