Commit Graph

6 Commits

Author SHA1 Message Date
joaquin 57c8f6fb64 feat: A/V health monitor, buffer bar and stream health dashboard
Backend (restream.py):
- Add _health_check_loop task: checks data flow every 5 s, updates
  av_health (ok/warning/error), auto-corrects stuck ffmpeg via SIGTERM
- Health thresholds: warning >12 s, error >25 s — normal reconnects
  (1-4 s) no longer trigger false warnings
- Count ffmpeg stderr A/V-warning events (av_desync_count) as metric
- Expose buffer_pct (server-side queue fill of slowest client),
  corrections (health-triggered ffmpeg restarts), av_health in stats()
- Revert wallclock timestamp flag: -use_wallclock_as_timestamps 1 was
  generating hundreds of spurious demuxer warnings per session, causing
  ffmpeg to stall and producing continuous video freezes
- Simplify ffmpeg cmd to minimal safe set: -reconnect 1
  -reconnect_streamed 1 -reconnect_delay_max 2

Dashboard (Dashboard.tsx):
- Add 6th StatCard "Salud A/V" with dynamic color and correction count
- Add "Salud A/V" column per stream: badge ok/aviso/error,
  corrections counter (violet), desync event count (grey)
- Add BufferBar: thin progress bar showing server queue fill %
  (green <40 %, yellow 40-70 %, red >70 %)
- Alert banner in header when any stream is in error av_health state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 01:14:37 +02:00
joaquin cccdf9f137 feat: multi-domain failover for provider accounts
Each ProviderAccount can now have multiple base URLs (provider_urls table).
On stream failure, BroadcastGroup cycles to the next domain immediately
with no wait; backs off only after all domains have been tried once.
Background health checker pings every domain every 5 min via player_api.php
and updates status/response_ms. Admin UI shows domain list with color-coded
status badges and a "Verificar todos" button per provider.
2026-05-18 00:11:06 +02:00
joaquin 3a450214ab fix: use cumulative CPU average for ffmpeg monitoring
Delta sampling over 2s returns 0-1 integer ticks for low-CPU processes
(ffmpeg copy mode ~0.3% CPU), always rounding to 0.0%. Switch to
cumulative average (total_cpu_ticks / clk_tck / elapsed) — same method
ps uses — which gives stable, accurate readings. Also show 2 decimal
places so values like 0.34% are visible.
2026-05-17 23:56:05 +02:00
joaquin ac06691656 feat: show ffmpeg PID and CPU% per stream in dashboard
Backend samples /proc/{pid}/stat every 2s to calculate CPU usage of
each ffmpeg process and exposes ffmpeg_pid + ffmpeg_cpu_pct in stats().
Dashboard shows a cyan ffmpeg badge with live CPU% per stream row,
plus a new StatCard with total ffmpeg CPU across all active streams.
2026-05-17 23:50:10 +02:00
joaquin 5179dbfa6d feat: replace aiohttp pump with ffmpeg copy-mode remux
Uses ffmpeg -c copy (no transcoding) with -reconnect_streamed to handle
provider session-token refreshes transparently. ffmpeg normalises PTS/DTS
across reconnects, eliminating A/V desync permanently. Quality is bit-for-
bit identical to the source stream.
2026-05-17 23:45:11 +02:00
joaquin f5d6745ed0 Initial commit: KiraTV IPTV proxy server
Full-stack IPTV management system with Xtream Codes API compatibility,
multi-account provider fan-out, Jellyfin local library integration,
real-time dashboard, EPG support, and A/V-sync-safe stream recovery.
2026-05-17 23:22:05 +02:00