Skip to content

Fast live-join option for realtime raw-TS sources (IPTV zapping) #195

Closed

Description

@Simpendaal

What should the engine do?

Raw MPEG-TS live over HTTP (Xtream-style IPTV, isLive: true) takes 10–18 s to first frame on the native path. With targetSegmentDuration = 4.0, the first manifest is gated on 3×TD of content (HOLD-BACK 18 s via LiveEdgePolicy.startupCushionSatisfied), and a strict-realtime origin fills that buffer in wall-clock time. When the origin happens to serve a burst backlog, the join drops to ~4.5 s, which shows the gate itself is the bottleneck, not the source or the demuxer (first data arrives in ~250 ms).

For live TV zapping this is prohibitive next to FFmpeg-renderer players (~1–2 s to first frame). Sessions that dispatch to the software path (e.g. interlaced H.264) join nearly instantly, so the gap is native-path-specific.

Would you consider a LoadOptions knob for low-latency live join — e.g. liveJoinProfile: .fastZap — that:

cuts shorter live segments (~2 s), and
serves the first manifest at minStartupSegments with a reduced HOLD-BACK, accepting a slightly higher early-rebuffer risk as an explicit host opt-in?
Channel zapping UX prefers "picture fast, small chance of one early rebuffer" over "guaranteed-safe join after 10+ seconds of black".

Happy to test against real Xtream sources (progressive 1080p50 H.264, ~6 Mbps, strict-realtime origins as well as bursty ones).

Motivating media or use case

A LoadOptions knob for low-latency live join - e.g. liveJoinProfile: .fastZap - that:

  1. cuts shorter live segments (~2 s), and
  2. serves the first manifest at minStartupSegments with a reduced HOLD-BACK,
    accepting a slightly higher early-rebuffer risk as an explicit host opt-in.

Channel zapping UX prefers "picture fast, small chance of one early rebuffer"
over "guaranteed-safe join after 10+ seconds of black". Happy to test against
real Xtream sources (both strict-realtime and bursty origins).

Area

Codec / container support

Host app / integration context

NowSeen - IPTV Player

Would you be willing to open a PR?

Yes

Activity

  1. added
    enhancement
    on Jul 22, 2026
  2. superuser404notfound commented on Jul 22, 2026

    @superuser404notfound
    Owner

    Implemented on #197: LoadOptions.liveJoinProfile = .fastZap.

    Your diagnosis was exactly right, and the burst-backlog observation (~4.5 s join) is the proof: a backlog fills the startup cushion at I/O speed, so the gate itself is what a strict-realtime origin pays for in wall-clock time. One correction to the proposed shape, though: serving the first manifest with a reduced HOLD-BACK is not on the table. HOLD-BACK has a hard spec floor of 3 x TARGETDURATION (RFC 8216bis 4.4.3.8), and AVPlayer enforces that distance from the live edge regardless of what the playlist claims. Undercutting it is precisely the -16832 restart loop the gate was introduced to fix in #189.

    So the profile shrinks TARGETDURATION itself instead of the holdback:

    Measured against a strict-realtime origin fixture shaped like your channels (progressive 1080p50 H.264, GOP = 1 s, ~6 Mbps TS, zero backlog): readyToPlay at +2.0 s with .fastZap vs +20.0 s with .standard, stable playback afterwards, no -16832 / -12888. Join speed tracks the origin's keyframe interval: a 2 s GOP lands at TD=2 and a 6 s holdback, a 1 s GOP at TD=1 and 3 s.

    The trade-off you offered to accept is real and documented on the option: a smaller TARGETDURATION also tightens AVPlayer's unchanged-playlist patience and live-edge buffer, so an origin that stalls or bursts mid-stream will rebuffer or error more readily than under .standard. Opt in for zapping, keep .standard for lean-back viewing.

    You can A/B it locally with the repro harness on the branch:

    swift run aetherctl live --realtime --preroll 0 --seed <your-capture.ts>            # .standard
    swift run aetherctl live --realtime --preroll 0 --fast-zap --seed <your-capture.ts> # .fastZap
    

    --preroll 0 models a strict-realtime origin with no backlog burst; the log prints timestamped readyToPlay plus a JOIN metric. Testing against your real Xtream origins (both the strict-realtime and the bursty ones) before we cut a release would be very welcome.

  3. Simpendaal commented on Jul 22, 2026

    @Simpendaal
    Author
  4. superuser404notfound commented on Jul 22, 2026

    @superuser404notfound
    Owner

    Released in 5.19.0 (the release is content-identical to the branch you tested, so your verification carries over 1:1).

    Thank you for the thorough field pass: the LagDiag numbers, the repeated-zap and mid-blocking-reload teardown checks, and especially the HLG/RASL seam confirmation on the HEVC channel. The 1.1-1.2 s joins with TARGETDURATION:2 / HOLD-BACK=6.000 on real origins are exactly the shape the profile was designed to hit; your origins clearly hand out a short connect backlog, which fills the 6 s gate at I/O speed instead of wall-clock, which is also why the same channels needed 11-20 s under .standard (18 s gate minus backlog).

    Closing as released and reporter-verified. If a bursty origin ever misbehaves under .fastZap mid-stream (the tighter-patience trade-off documented on the option), please open a fresh issue with the cadence logs.

  5. Simpendaal commented on Jul 22, 2026

    @Simpendaal
    Author
  6. Simpendaal commented on Jul 23, 2026

    @Simpendaal
    Author

    ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions