From fd93c0dc3d9afbd7cdac54ee4273dabdeee00f62 Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Thu, 25 Jun 2026 14:24:30 -0500 Subject: [PATCH] fix(channel management): Implement channel initialization grace period handling to ensure proper state transitions during live stream startup. Channels now honor the configured grace period for buffer filling, promoting to active state when conditions are met. Updated related tests and documentation for clarity. (Fixes #1380) --- CHANGELOG.md | 2 + apps/channels/tests/test_ts_proxy_teardown.py | 128 +++++++++++++++++- apps/proxy/config.py | 2 +- apps/proxy/live_proxy/client_manager.py | 2 + apps/proxy/live_proxy/config_helper.py | 2 +- apps/proxy/live_proxy/input/manager.py | 22 ++- apps/proxy/live_proxy/output/ts/generator.py | 6 +- apps/proxy/live_proxy/server.py | 30 ++-- .../live_proxy/services/channel_service.py | 72 ++++++++++ core/serializers.py | 4 +- frontend/src/constants.js | 5 +- 11 files changed, 227 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac28b41a..50b7e9ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **Channel Initialization Grace Period is honoured during live stream startup.** Preview and playback no longer abort after a hardcoded 10s while the channel is still connecting with an empty buffer; the TS generator init-wait stall check and upstream health monitor now use the configured `channel_init_grace_period` (same as the server cleanup watchdog) instead of `CONNECTION_TIMEOUT`. (Fixes #1380) +- **Channels are marked `active` as soon as the buffer threshold is met and a client is streaming.** Once the initial buffer fills, state is set to `active` immediately when viewers are attached, or `waiting_for_clients` when the buffer is ready but no client is connected yet (e.g. proxy API warmup). The cleanup watchdog no longer waits an extra grace period before promoting to `active`. Proxy settings copy now describes `channel_init_grace_period` as an initialization buffer timeout. - **DVR recording playback auth is complete for native video, HLS segments, and redirects.** Completed recordings use `/file/` with native `