Current state
The /api/iptv/live/{identifier} endpoint streams raw MPEG-TS via ffmpeg -c copy -f mpegts pipe:1, which makes us a valid HDHomeRun emulator for Plex. Plex Live TV is working for most channels.
Known gaps / improvements needed
Session deduplication
Each request to /live/{identifier} spawns a new state.start_stream() session and a new FFmpeg process. Plex probes and retries the URL multiple times (especially on slow connections / hotspot). This can exhaust Tablo tuner slots. We should deduplicate: if a session for identifier is already active, reuse it rather than opening a second one.
FFmpeg process lifecycle
The FFmpeg subprocess is killed only when the HTTP streaming generator finishes (client disconnects). If Plex drops and reconnects quickly, the old process may not be dead yet. Add a small cleanup grace period or track live FFmpeg PIDs per identifier.
Tuner count accuracy
/discover.json reads tuner count from /server/info. Verify this matches the actual Tablo model tuner count (2 vs 4) and that we don't report more tuners than the device supports.
Latency on first tune
On slow connections (hotspot, WAN), Plex's initial connect times out before FFmpeg opens the Tablo HLS stream (~2–3s). Consider pre-opening the Tablo stream before returning 200, or lowering the FFmpeg startup buffer.
HDHomeRun lineup.json channel numbers
OTT/streaming channels have no major/minor numbers. They fall back to call_sign as the guide number. Plex may not match these to EPG entries correctly. Investigate whether a synthetic major.minor assignment would help.
Acceptance criteria
Current state
The
/api/iptv/live/{identifier}endpoint streams raw MPEG-TS viaffmpeg -c copy -f mpegts pipe:1, which makes us a valid HDHomeRun emulator for Plex. Plex Live TV is working for most channels.Known gaps / improvements needed
Session deduplication
Each request to
/live/{identifier}spawns a newstate.start_stream()session and a new FFmpeg process. Plex probes and retries the URL multiple times (especially on slow connections / hotspot). This can exhaust Tablo tuner slots. We should deduplicate: if a session foridentifieris already active, reuse it rather than opening a second one.FFmpeg process lifecycle
The FFmpeg subprocess is killed only when the HTTP streaming generator finishes (client disconnects). If Plex drops and reconnects quickly, the old process may not be dead yet. Add a small cleanup grace period or track live FFmpeg PIDs per identifier.
Tuner count accuracy
/discover.jsonreads tuner count from/server/info. Verify this matches the actual Tablo model tuner count (2 vs 4) and that we don't report more tuners than the device supports.Latency on first tune
On slow connections (hotspot, WAN), Plex's initial connect times out before FFmpeg opens the Tablo HLS stream (~2–3s). Consider pre-opening the Tablo stream before returning 200, or lowering the FFmpeg startup buffer.
HDHomeRun
lineup.jsonchannel numbersOTT/streaming channels have no
major/minornumbers. They fall back tocall_signas the guide number. Plex may not match these to EPG entries correctly. Investigate whether a synthetic major.minor assignment would help.Acceptance criteria