Skip to content

A live open whose stream parameters never resolve has no bounded terminal state #466

Closed

Description

@superuser404notfound

What happens

A live source carrying an audio codec with no decoder parks the engine at startup 2/8 containerOpened and stays there. Nothing reaches the host: no picture, no error, no phase change. The session is only ended by the viewer backing out.

Observed on an ATSC 3.0 (NextGen TV) channel from an HDHomeRun tuner through Jellyfin, reported downstream as Sodalite#100. Redacted host log:

12:42:03.062 [LiveDirect] route=tunerfile path=/LiveTv/LiveStreamFiles/<stream-id>/stream.ts
12:42:03.090 [AetherEngine] #361 startup 0/8 dispatched (gen 1)
12:42:03.211 [AetherEngine] #361 startup 1/8 sourceOpened (gen 1)
12:42:03.624 [AetherEngine] #361 startup 2/8 containerOpened (gen 1)
   ... 11s, no further progress, viewer gives up ...
12:42:14.906 [AVIOReader] pump conn gen=1 ended with error: cancelled
12:42:14.928 [mpegts] [warning] Could not find codec parameters for stream 1 (Audio: ac4 (AC-4 / 0x342D4341), 0 channels): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (60000000) and 'probesize' (52428800) options
12:42:14.928 [mpegts] [warning] Could not find codec parameters for stream 3 (Audio: ac4 (AC-4 / 0x342D4341), 0 channels): unspecified sample rate

The cancelled line and both warnings are the teardown from backing out, not a recovery the engine attempted.

Why it stalls

find_stream_info cannot resolve a stream whose codec has no decoder compiled in, so it spends the full budget trying. FFmpeg has no AC-4 decoder at all (verified: avcodec_find_decoder returns NULL for both AV_CODEC_ID_AC4 and AV_CODEC_ID_MPEGH_3D_AUDIO against the pinned FFmpegBuild slice, and libavcodec/allcodecs.c upstream names neither), so this is not a build-flag question.

On a live source the budget is spent at the wire rate: probesize 50 MB of a ~10 Mbps broadcast is roughly 40 s of wall clock, and max_analyze_duration 60 s is 60 s of it. So the honest description is not "forever" but "40 to 60 s of nothing, then a silent fail-open", since LoadOptions.probesize already documents that an over-tight budget "fails OPEN, not closed: find_stream_info still returns success with a logged warning, so the session loads with late-resolving tracks silently missing". Nobody in the report waited long enough to see which of the two it ends on.

The gap

Neither end of that is something a host can act on:

  • during the wait there is no signal that distinguishes "still probing" from "hung", startupProgress simply stops at containerOpened;
  • at the end the source either loads without the audio it was supposed to carry, or fails with a message about the wrong thing.

The general shape is not AC-4 specific. Any source whose stream parameters cannot be resolved, and any live origin that delivers too slowly to fill the budget, lands in the same place.

What would fix it

Some bounded outcome on a live open, so a host can say something true. Rough order of preference:

  1. A live-specific default probe budget, so the wait is a few seconds rather than most of a minute. This also shortens every zap, so it is not only a bug fix. Note this was deliberately held back once before (AetherEngine work for Sodalite#70) so that a demux failure would stay attributable to the route change being tested at the time; that reason has expired.
  2. A distinct terminal state or PlaybackErrorKind for "the container opened but its streams never resolved", so the fail-open stops looking like a successful load with missing tracks.
  3. Failing both, a progress signal during the probe, so a host can tell a stall from patience.

Downstream mitigation already shipped: Sodalite refuses a live channel up front when every audio track the server named is a format nothing decodes, using the codec string Jellyfin already hands it. That covers the codecs anyone enumerated, and only for hosts that have such metadata. It is not a substitute for a bounded open.

Activity

  1. added
    bug
    on Sep 2, 2026
  2. superuser404notfound commented on Sep 2, 2026

    @superuser404notfound
    OwnerAuthor

    Fixed on main in ea8ea58, merged as 1e04289. It ships in the next release.

    One correction to the issue above, which was mine and was wrong in an important way. I wrote that the pass "always runs until probesize, max_analyze_duration or EOF" on a transport stream, on the grounds that the "all info found" exit is skipped for AVFMTCTX_NOHEADER formats. The first half is true, but mpegts.c clears that flag as soon as every program has received a PMT, under a comment that says exactly why:

    // stop find_stream_info from waiting for more streams
    // when all programs have received a PMT

    So a healthy channel does take the early exit, and this was never a general property of live TS. It was one stream holding the door open.

    What actually cost the time. has_codec_parameters fails an audio stream with no sample rate, and that value can only come from the container or from opening a decoder. With no decoder compiled in, try_decode_frame gives up on the first packet (found_decoder goes negative), but the outer loop keeps reading anyway, because its only exit is every stream satisfying has_codec_parameters. One undecodable stream therefore spends the entire budget and then fails open with the track missing regardless.

    The fix parks such a stream out of the probe's way and restores it immediately after, which is the lever the attached-picture fix already uses (#75): has_codec_parameters asks nothing of an ATTACHMENT stream. The restore has to follow find_stream_info rather than be skipped as redundant, because it writes its internal context back over codecpar on the way out. What a caller ends up with is exactly the state a full-budget probe would have left, an audio stream whose parameters never resolved, reached without paying for it.

    Measured on a synthetic 120 s transport stream built in the test, since the reported source needs an ATSC 3.0 tuner:

    bytes read
    video only 262,144
    video + AC-4, before 1,572,864
    video + AC-4, after 262,144

    The 1,572,864 is exactly the 60 s cap landing halfway through a 120 s stream, which is where the reported minute came from.

    Deliberately not built, and the reasons are worth recording.

    A live-specific probe budget (option 1 above) was implemented and then reverted. On the same fixture it produced the same reach as the parking does, so there was no case where it demonstrably helped on its own, and shipping it anyway would have been an unproven behaviour change on every live open. That is the same reason it was held back once before in Sodalite#70: two changes at once make a failure unattributable. LoadOptions.probesize / maxAnalyzeDuration remain available to any host that wants a tighter live budget today.

    Nothing new is published to hosts (option 2). audioTracks already names the codec, so a host can say "this channel's audio is AC-4" without new API, and Sodalite now does exactly that from server metadata, before a tuner is even opened.

    Still open, and narrower than this issue started out. Whether any live source stalls at containerOpened for a reason other than a stream nothing can decode. The class the parking covers is "codec with no decoder compiled in"; a stream whose codec has a decoder but whose payload never yields a frame (a scrambled or just-started audio PID) is not covered by it, and in a synthetic reproduction it stopped after ~5 MB rather than running away. If a report shows one of those costing real time, the live budget comes back with a case behind it.

  3. superuser404notfound commented on Sep 3, 2026

    @superuser404notfound
    OwnerAuthor

    Released in 6.62.1 (ea8ea58, merged as 1e04289), the same morning as the comment above; this thread never got the note. The host-side half (Sodalite#100, a profile that refuses AC-4 before the route is chosen) lives in its own thread. Closing.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions