Skip to content

Bursty-ingest detection trusts self-reported TARGETDURATION, not observed cadence -- LL-HLS blocking-reload stays enabled and stalls with -15410 #167

Closed

Description

@G00380316

What happened?

Live HLS playback via the HLSLiveIngestReader ingest path (the engine-provided LiveIngestSourceInfo-conforming reader intended for exactly this use case) periodically stalls with CoreMediaErrorDomain -15410 "Invalid server blocking reload behavior for low latency", followed by the engine's own stall-recovery nudge-seek, then resumes playing -- looping through this cycle repeatedly rather than staying stable.

Root cause, as far as I can trace it: HLSLiveIngestReader.upstreamTargetDuration (IO/HLSIngest/HLSLiveIngestReader.swift:49-50,175-176) is set from media.targetDuration -- the upstream origin's self-declared #EXT-X-TARGETDURATION playlist tag -- not from the actually-observed segment-arrival cadence. HLSVideoEngine's init (Video/HLSVideoEngine.swift:543-547) only disables LL-HLS blocking-reload (liveBlockingReloadEnabled) when this hint exceeds 1.5x the internal cut target:

// Bursty ingest sources whose upstream cadence exceeds 1.5x our cut target can't honor
// LL-HLS blocking reload (-15410, device repro 2026-06-11). For those, disable blocking
// reload and raise TARGETDURATION to cadence so plain 1.5x-TD patience covers the gap.
self.liveBlockingReloadEnabled = liveSourceCadenceHint
    .map { $0 <= Self.targetSegmentDuration * 1.5 } ?? true

If an origin advertises a normal TARGETDURATION but doesn't actually deliver segments on that schedule (common for relay/budget IPTV origins that push segments in irregular batches rather than encoding in disciplined real time), that mismatch is invisible to this check: the advertised value looks fine, blocking-reload stays enabled, and the held ?_HLS_msn= reload eventually resolves in a way AVPlayer treats as a spec violation.

Separately: for any live source that isn't routed through a LiveIngestSourceInfo-conforming custom reader (i.e. loaded via a plain url:, which HLSSegmentProvider's default liveBlockingReloadEnabled { true } and HLSVideoEngine's ?? true fallback both confirm), there's no cadence signal at all and blocking-reload is enabled unconditionally -- the public LoadOptions struct has no field to influence this either way.

Steps to reproduce

  1. Load a live source through the .custom(HLSLiveIngestReader(playlistURL:), formatHint: "mpegts") path.
  2. Use an origin whose playlist advertises a normal #EXT-X-TARGETDURATION but whose real segment delivery is bursty/irregular (does not actually land on that schedule).
  3. Play for roughly a minute; observe periodic stalls, -15410 in the AVPlayer error log, and the engine's own "re-engaging stalled AVPlayer... nudge seek" recovery firing repeatedly.

AetherEngine version or commit SHA

5.14.0 / 396d138

Host app

Custom / my own integration

Platform

iOS

OS version

iOS 27 (iPhone 16 Pro Max) / iPadOS 26.5.1 (iPad 10th generation) -- reproduced on both.

Device / chip

iPhone 16 Pro Max; iPad (10th generation)

Playback path

Native AVPlayer (loopback HLSLocalServer / HLSVideoEngine, via the .aetherHLSIngest-style custom-reader route -- not the nativeRemoteHLS bypass, which has no loopback).

Source media (for playback bugs)

Live HLS ingest (fMP4 segments muxed by the engine), video hvc1 3840x2160 (HDR10/PQ, ITU-R 2020), audio ec-3 5.1 48kHz. Master/media playlists served locally by HLSLocalServer.

Error codes / log lines

[NativeAVPlayerHost] #17 playbackStalled
[NativeAVPlayerHost] #17 timeControlStatus=waitingToPlay reason=AVPlayerWaitingToMinimizeStallsReason t+11.04s
[AetherEngine] #65 re-engaging stalled AVPlayer (stall + 6s without fetches): nudge seek to 70.87s
[HLSLocalServer] GET /media.m3u8?_HLS_msn=17 HTTP/1.1
[NativeAVPlayerHost] #17 errorLog code=-15410 domain=CoreMediaErrorDomain uri=- 'Invalid server blocking reload behavior for low latency'

Full surrounding sequence (master/media playlist fetches, segment fetches, LagDiag telemetry) available if useful.

Anything else

Two possible fixes, either of which would close this:

  1. Derive liveSourceCadenceHint (or an equivalent internal signal) from the observed inter-segment arrival interval rather than trusting the origin's self-reported TARGETDURATION -- the whole point of the hint is to detect origins that don't behave as advertised, so trusting their own advertisement undermines it.
  2. Default liveBlockingReloadEnabled to false (safer) rather than true for any live source where no cadence signal is available at all, rather than only disabling it when a hint positively proves burstiness.

Happy to test a build with either change against the reproducing origin.

Activity

  1. superuser404notfound commented on Jul 21, 2026

    @superuser404notfound
    Owner

    Fixed in 5.16.0.

    Your trace was exactly right: both the blocking-reload gate and the TARGETDURATION floor derived from HLSLiveIngestReader.upstreamTargetDuration (the origin's self-declared #EXT-X-TARGETDURATION), and that value was read once at load and frozen into an immutable decision. An origin that advertises a normal target but delivers in bursts kept CAN-BLOCK-RELOAD=YES, so the held ?_HLS_msn= reload tripped -15410.

    Both decisions now derive from the OBSERVED inter-arrival cadence instead, measured in the ingest reader and re-evaluated on every manifest render:

    • Blocking-reload starts OFF, latches ON only after a sustained window of disciplined cadence, and latches permanently OFF the moment a burst is seen. Because it starts OFF, a bursty origin never advertises blocking-reload in the first place, so -15410 cannot arise. The transition is deliberately monotonic OFF -> ON -> OFF(terminal): ON/OFF flapping would straddle an in-flight blocking reload and trip -15410 on its own.
    • The TARGETDURATION floor tracks the monotonic max observed cadence, so AVPlayer's 1.5x-target unchanged-playlist patience always covers the real inter-batch gap (this keeps the fix from re-manifesting as -12888).

    On your second point: plain-url: live with no cadence signal (for example a disciplined real-time transcode) keeps blocking-reload on by default, so that path is not regressed, but there is now a LoadOptions.liveBlockingReload: Bool? to force it either way when a host knows a source is bursty.

    Since you offered to test: could you retest 5.16.0 against the reproducing origin? Expected result is no -15410, no periodic nudge-seek recovery, and a #EXT-X-TARGETDURATION in the local media.m3u8 that reflects the real batch cadence rather than the advertised one.

    Thanks for the precise root-cause writeup, it made this a targeted fix.

  2. G00380316 commented on Jul 21, 2026

    @G00380316
    Author

    Retested on 5.17.1 (includes 5.16.0). The original bug is fixed: 30+ seconds of steady playback on the same bursty origin with no -15410 and no nudge-seek recovery at all — clean throughout.

    However, a different trigger reproduces the same -15410 error on the same session, and I don't think it's the cadence mechanism this fix addressed:

    [HLSSegmentProducer] no-cut stall: no segment finalized for 10s (packetsRead=6716, sinceFinalize=411, rate=40.1pkt/s, cutter wedge); window video=210 key=2 audio=201 foreign=0 videoPtsAdvance=4.1s; exiting for host retune
    [HLSSegmentProducer] pump finished: reason=segmentStall packetsRead=6716 packetsWritten=3380 lastError=0 elapsed=43597ms cacheCount=12
    [HLSVideoEngine] live segment cutter stalled (likely SSAI ad pod); requesting host retune to the server route
    [AetherEngine] onLiveSourceReset → publishing liveSourceReset to host
    ...
    [NativeAVPlayerHost] #8 errorLog code=-15410 domain=CoreMediaErrorDomain uri=- 'Invalid server blocking reload behavior for low latency'
    ...
    [AetherEngine] #65 re-engaging stalled AVPlayer (stall + 6s without fetches): nudge seek to 67.36s
    ...
    [AetherEngine] #65 nudge did not revive the consumer; reloading item at 67.36s (same URL, same host)
    [NativeAVPlayerHost] #9 load url=http://127.0.0.1:55818/media.m3u8 startPos=67.36s ...
    ...
    [NativeAVPlayerHost] #9 errorLog code=-15410 domain=CoreMediaErrorDomain uri=- 'Invalid server blocking reload behavior for low latency'
    

    Reading the sequence: blocking-reload had already latched ON during the steady period (#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES, TARGETDURATION:6, segments landing consistently at ~5.76s). Then the segment producer itself stalls -- your own log already suspects an SSAI ad pod disrupting cut-point detection, not a network/cadence issue. While the producer is wedged, the held ?_HLS_msn=12 reload keeps waiting for a segment that the stalled producer will never cut, and -15410 fires. It fires a second time shortly after the automatic retune/reload too, before the new item (#9) settles.

    So this looks like a different mechanism from the one 5.16.0 fixed: blocking-reload stays latched ON through a genuine local producer stall (unrelated to origin network cadence), rather than dropping when the producer itself wedges. Still digging into this on our end before writing it up properly -- wanted to get the positive retest result to you first, since the original fix clearly holds for its intended case.

  3. added 2 commits that reference this issue on Jul 21, 2026
  4. superuser404notfound commented on Jul 21, 2026

    @superuser404notfound
    Owner

    Thanks for the retest, and for the second trace. No need for a separate writeup, the log you posted was enough to pin it.

    Your read is exactly right: this is a different mechanism from the 5.16.0 fix, and the cadence policy structurally cannot see it. It observes ingest arrivals, and during a cutter wedge those keep flowing (your trace: 40 pkt/s read rate while nothing finalizes), so blocking-reload stayed latched ON while the producer could no longer cut the segment the held ?_HLS_msn=12 reload was waiting for. Two defects then converted the wedge into -15410:

    1. When the hold timed out, the server answered with the unchanged playlist, without the requested MSN. That is spec-invalid for a blocking reload (RFC 8216bis requires a 503 there), and it is precisely what AVPlayer flags as "invalid server blocking reload behavior".
    2. The segmentStall exit only requested the host retune. It neither released the parked waiter (which slept out its full hold against a dead producer) nor dropped the CAN-BLOCK-RELOAD advert, so the stall watchdog's item reload (#9) against the same server immediately armed a second hold and a second -15410.

    Fixed in 5.17.4:

    • An unsatisfiable held blocking reload is now answered with a retriable 503 instead of the unchanged 200. Satisfied holds and the gate-off immediate serve are unchanged.
    • Every live pump exit that delegates to host retune (segmentStall, sourceReplay, custom-reader pump deaths) latches the provider production-halted: parked waiters release immediately (so the in-flight hold resolves as a 503 within the ~10s stall-detection window instead of a bad 200 at 18s), and CAN-BLOCK-RELOAD stops being advertised for the rest of the session, including any item reload against it. The latch also beats the LoadOptions.liveBlockingReload override, since no override can conjure segments from a dead pump.

    The wedge itself still exits to host retune, that part of your log is the designed recovery for an SSAI pod the cutter cannot cut through. What changes is the window before the retune lands: no -15410, and no error-driven fighting between the nudge/reload watchdog and the retune.

    Could you retest on 5.17.4 against the same SSAI trigger? Expected: the no-cut stall log line and the host retune still appear, but no -15410 before or after the item reload, and the retuned session comes up clean.

  5. superuser404notfound commented on Aug 8, 2026

    @superuser404notfound
    Owner

    Closing this one, with the state written down so it can be picked up again if it recurs.

    Both halves shipped and the first one was verified on device by the reporter:

    • The observed-cadence gate and the monotonic TARGETDURATION floor: b2f1206, released in 5.16.0. Verified here against a bursty origin running 30+ seconds clean.
    • The follow-up for the second trigger found on that retest, a local producer stall while blocking-reload was already latched on: f915e1b, released in 5.17.4. The server now answers 503 to an unsatisfiable hold instead of a spec-invalid 200 with an unchanged playlist, and a halted live production latches terminally and cancels waiters immediately.

    Nothing has been reported against either since, so the remaining item was never a defect, only an unverified transition: the mid-session OFF to ON flip, where a source proves 12 seconds of disciplined cadence and the local playlist then starts advertising CAN-BLOCK-RELOAD while AVPlayer is already attached. There is no source at hand here that exercises it.

    Worth stating plainly for anyone who lands on this later: that transition currently has no log line. LiveCadencePolicy emits nothing and liveBlockingReloadEnabled is a computed property read per manifest render, so a clean run cannot be distinguished from a source that never latched at all. If -15410 shows up again on an ingest source with regular cadence, the first step is to add that witness rather than to reason from a quiet log.

    Reopen any time, or open a fresh issue with the playlist and the error, whichever fits better.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions