Commit graph

81 commits

Author SHA1 Message Date
SergeantPanda
d676903825 Enhancement: Cache channel names to reduce repeated DB queries in StreamManager and StreamGenerator. This improves performance by avoiding unnecessary database calls during retries and logging events. (Fixes #1138)
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
2026-04-17 10:55:41 -05:00
SergeantPanda
6cd6d3ef9a Enhancement: - **Output bitrate DB persistence**: the ffmpeg_output_bitrate stat is no longer written to the database on every FFmpeg stats tick (~2/second). Instead, a local exponential moving average (EMA, α=0.1) accumulates readings continuously. The first 10 samples (~5 seconds) are discarded as warmup to avoid polluting the average with FFmpeg's unstable ramp-up values. After warmup, the smoothed value is flushed to the database at most once every 30 seconds, and a final flush occurs when the stream stops but only if the EMA has been seeded (i.e. the stream ran past warmup). Streams that stop during warmup leave the existing database value untouched, preserving previously accurate measurements when channel-hopping. 2026-04-16 17:15:54 -05:00
dekzter
90a600b48f merged in dev 2026-03-26 12:17:43 -04:00
None
c65ace1a7c fix: stuck channel states and ghost clients in TS proxy
- Write ERROR via ownership check OR state guard fallback when ownership TTL expired during retries
- Add INITIALIZING to cleanup task grace period monitoring
- Validate client SET entries against metadata hashes in orphaned channel cleanup; remove ghosts and clean up when no real clients remain
- Stats page self-heals by removing ghost SET entries on read
- Extract remove_ghost_clients() helper to ClientManager
- Add ChannelState.PRE_ACTIVE constant
- Fix 6 pre-existing NonOwnerWorkerKeepalive test failures
2026-03-14 19:24:01 -05:00
dekzter
6f4665e6eb merged in dev 2026-02-26 08:20:20 -05:00
SergeantPanda
daa919c764 Refactor logging messages in StreamManager for clarity and consistency. Also removed redundant parsing. 2025-12-23 15:52:56 -06:00
SergeantPanda
ff7298a93e Enhance StreamManager for efficient log parsing and update VLC stream profile naming 2025-12-23 15:07:25 -06:00
Seth Van Niekerk
aa5db6c3f4
Squash: Log Parsing Refactor & Enhancing 2025-12-22 15:14:46 -05:00
Seth Van Niekerk
88c10e85c3
Add VLC TS demux output detection for codec parsing 2025-12-15 20:09:54 -05:00
dekzter
4a23883d0c merged in upstream 2025-12-05 08:34:29 -05:00
SergeantPanda
89a23164ff Enhancement: Add system event logging and viewer with M3U/EPG endpoint caching
System Event Logging:
- Add SystemEvent model with 15 event types tracking channel operations, client connections, M3U/EPG activities, and buffering events
- Log detailed metrics for M3U/EPG refresh operations (streams/programs created/updated/deleted)
- Track M3U/EPG downloads with client information (IP address, user agent, profile, channel count)
- Record channel lifecycle events (start, stop, reconnect) with stream and client details
- Monitor client connections/disconnections and buffering events with stream metadata

Event Viewer UI:
- Add SystemEvents component with real-time updates via WebSocket
- Implement pagination, filtering by event type, and configurable auto-refresh
- Display events with color-coded badges and type-specific icons
- Integrate event viewer into Stats page with modal display
- Add event management settings (retention period, refresh rate)

M3U/EPG Endpoint Optimizations:
- Implement content caching with 5-minute TTL to reduce duplicate processing
- Add client-based event deduplication (2-second window) using IP and user agent hashing
- Support HEAD requests for efficient preflight checks
- Cache streamed EPG responses while maintaining streaming behavior for first request
2025-11-20 17:41:06 -06:00
SergeantPanda
6e79b37a66 When stream_type is UDP do not add user_agent to FFmpeg command. 2025-11-13 14:04:46 -06:00
SergeantPanda
b9e819e343 Enhancement: Adds support for UDP streams. Closes #617 2025-11-11 18:30:59 -06:00
SergeantPanda
a7f449f746
Merge pull request #565 from ragchuck:enable-rtsp
feat: added support for rtsp
2025-11-11 17:29:03 -06:00
SergeantPanda
b608af1d51 Auto detect RTSP streams when proxy profile is selected and force FFmpeg. 2025-11-11 17:26:56 -06:00
dekzter
50e9075bb5 initial run of a binary and encoded redis client - no more encoding / decoding data into redis, huge PITA (still some outstanding spots I need to patch) 2025-10-25 08:15:39 -04:00
SergeantPanda
9b2ebf169b Better database connection cleanup. 2025-10-16 14:22:19 -05:00
SergeantPanda
ed065f718d Enhancement: Implement caching for proxy settings to improve performance and reduce database load. Also, ensure database connections are closed after use in both config and stream manager. 2025-10-14 13:44:28 -05:00
SergeantPanda
404d2f82a3 Switch HTTP streamer to a thread and pipe its output to a local pipe where the fetch chunk can access it the same way our transcode processes would be accessed. Simplifies the code. 2025-10-12 09:42:15 -05:00
SergeantPanda
74280baa85 Changed read timeout for http connection for the proxy server to 10 secounds to avoid unnecessary timeouts.
Improved try_next_stream to not fail if the returned stream is the same. It will now try a different stream.
Force a client to jump ahead in the buffer if they fall to far behind.
2025-10-11 19:45:21 -05:00
SergeantPanda
fa08216600 Enhancement: Add chunk timeout configuration in ConfigHelper. Improve StreamManager timeout handling for consistency. Only 1 heartbeat thread per worker should be started now. Timeout on proxy reduced from 60 seconds to 5. 2025-10-11 18:08:20 -05:00
SergeantPanda
fefab4c4c6 Enhancement: Improve resource cleanup in ProxyServer and StreamManager classes to avoid "SystemError: (libev) error creating signal/async pipe: Too many open files" errors 2025-10-10 15:26:02 -05:00
SergeantPanda
6180b4ffef Save stream stats to database. 2025-07-28 21:40:29 -05:00
SergeantPanda
9f8a2db500 Include channel ID in more logs. 2025-07-09 16:44:00 -05:00
SergeantPanda
2284d47f9f If provider is slow but responsive, don't get locked up. 2025-07-08 17:10:55 -05:00
SergeantPanda
d6605e7119 Add timeout for chunks. 2025-07-08 15:57:11 -05:00
SergeantPanda
01d4b25303 Health monitor thread no longer will no longer attempt to reconnect it will only notify the main thread of issues. 2025-07-03 14:10:03 -05:00
SergeantPanda
55e19f05aa Check if stopping before adding chunks during transcoding. 2025-07-03 11:18:03 -05:00
SergeantPanda
580aa1975c Add process management for safe connection handling in StreamManager
- Introduced _wait_for_existing_processes_to_close method to ensure all existing processes and connections are fully closed before establishing new ones.
- Updated _establish_transcode_connection and _establish_http_connection methods to check for and close lingering processes and connections.
- Enhanced logging for better debugging and monitoring of connection states.
2025-07-03 11:02:07 -05:00
SergeantPanda
2b97a958cd Check if a transcode process is running also to determine if we should close sockets. 2025-07-01 10:27:24 -05:00
SergeantPanda
03f39d7d48 Rename FFMPEG_BITRATE to FFMPEG_OUTPUT_BITRATE for clarity. 2025-06-18 17:10:08 -05:00
SergeantPanda
2e118a3f8d Smarter parsing for input vs output streams. 2025-06-18 16:59:12 -05:00
SergeantPanda
ae88141c36 Change matching pattern for detecting input vs output streams in FFmpeg. 2025-06-17 21:33:26 -05:00
SergeantPanda
573ed96e82 Bug fix - Wait until FFmpeg is closed before marking the connection as closed. May fix some stuck FFmpeg processes. 2025-06-17 17:27:41 -05:00
SergeantPanda
b6cde2fec8 Only update redis if stream switch was successful. 2025-06-17 16:21:10 -05:00
SergeantPanda
838a373bea Use correct m3u_profile_id when changing streams. 2025-06-17 13:11:03 -05:00
SergeantPanda
1e9ab54609 Use new methods for getting settings. 2025-06-12 16:11:43 -05:00
SergeantPanda
bd53837f80 Better detection of input vs output stream information. 2025-06-11 17:20:27 -05:00
SergeantPanda
743cf4e297 Smarter parsing of ffmpeg stats output. 2025-06-11 16:55:14 -05:00
SergeantPanda
a2c7fc3046 [New feature]
Switch streams when buffering is detected.
2025-06-10 17:43:37 -05:00
SergeantPanda
f869daa37c Add stream type for stream (HLS/MPEGTS, ETC) 2025-06-10 09:51:56 -05:00
SergeantPanda
47500daafa Moved some functions to channel_service 2025-06-09 19:10:52 -05:00
SergeantPanda
7e25be0717 Store video and audio information in redis. 2025-06-09 18:57:36 -05:00
SergeantPanda
7d0c32ef3f Break line breaking for stats. 2025-06-09 17:45:00 -05:00
SergeantPanda
9d8e011e2c Store FFmpeg in redis. 2025-06-09 17:36:01 -05:00
SergeantPanda
4c79af1f30 Log ffmpeg stats 2025-05-28 15:26:42 -05:00
SergeantPanda
303123f3ec Buffer overflow error. 2025-05-21 09:44:09 -05:00
SergeantPanda
f762e1b923 Capture and display transcode strd err. 2025-05-09 13:44:49 -05:00
SergeantPanda
898224dc72 Fix potential issue during stream switches. 2025-05-05 17:02:28 -05:00
SergeantPanda
80fe7e02f8 Added missing _attempt_health_recovery. 2025-04-30 13:43:01 -05:00