Skip to content

Follow up 195 (cant re-open) #203

Closed
Closed

Description

@Simpendaal

What happened?

Follow-up from #195
<#195>/#197
<#197> — fastZap works
great on device. This is first-session-only, software path, physical Apple
TV (tvOS 26.5), never in the simulator. Reproduced identically across four
cold launches.

Symptom: the first dispatch: … → software session after app launch brings
up audio (decoder, resampler, first enqueue, seekClock) but produces no
video frame for ~10 s. It then recovers without any host-side action: we
verified our own retry watchdog was not involved — the recovery appears to
be your cold-start wedge revive (#93-style) firing on its internal
deadline, after which Deinterlace engaged [hardware] + first frame appear
and a same-URL reload plays in <0.6 s. Every subsequent software session in
the process joins instantly.

Timing detail: our layer measures buffering-finished at 9.7–10.3 s, i.e.
the stall is inside session bring-up before the first frame, one time per
process.

Suspects (both one-time-per-process, on the load path):

  1. First Metal pipeline compile for yadif_videotoolbox — later sessions
    hit the shader cache.
  2. First renderer AVAudioSession activation with HDMI route renegotiation —
    engine init logs maxChannels=2 output=2; the first session's renderer
    audio session active shows preferred=6 output=6 (2ch→6ch LPCM switch on
    a real HDMI sink).

Sessions: raw-TS IPTV, interlaced 1080i25 H.264 + AC-3 5.1. One run also
had thermal state serious, but the wedge reproduces regardless.

move this warmup off the first-frame path (precompile the deinterlace
pipeline at init/bind, and/or activate the renderer audio session
earlier/async), or shorten the revive deadline for the never-rendered
cold-start case. Host-side retries don't help — a fresh session re-wedges
until the warmup completes. Happy to test a branch on the same device; full
logs of all runs available.

Steps to reproduce

Follow-up from #195
<#195>/#197
<#197> — fastZap works
great on device. This is first-session-only, software path, physical Apple
TV (tvOS 26.5), never in the simulator. Reproduced identically across four
cold launches.

Symptom: the first dispatch: … → software session after app launch brings
up audio (decoder, resampler, first enqueue, seekClock) but produces no
video frame for ~10 s. It then recovers without any host-side action: we
verified our own retry watchdog was not involved — the recovery appears to
be your cold-start wedge revive (#93-style) firing on its internal
deadline, after which Deinterlace engaged [hardware] + first frame appear
and a same-URL reload plays in <0.6 s. Every subsequent software session in
the process joins instantly.

Timing detail: our layer measures buffering-finished at 9.7–10.3 s, i.e.
the stall is inside session bring-up before the first frame, one time per
process.

Suspects (both one-time-per-process, on the load path):

  1. First Metal pipeline compile for yadif_videotoolbox — later sessions
    hit the shader cache.
  2. First renderer AVAudioSession activation with HDMI route renegotiation —
    engine init logs maxChannels=2 output=2; the first session's renderer
    audio session active shows preferred=6 output=6 (2ch→6ch LPCM switch on
    a real HDMI sink).

Sessions: raw-TS IPTV, interlaced 1080i25 H.264 + AC-3 5.1. One run also
had thermal state serious, but the wedge reproduces regardless.

move this warmup off the first-frame path (precompile the deinterlace
pipeline at init/bind, and/or activate the renderer audio session
earlier/async), or shorten the revive deadline for the never-rendered
cold-start case. Host-side retries don't help — a fresh session re-wedges
until the warmup completes. Happy to test a branch on the same device; full
logs of all runs available.

AetherEngine version or commit SHA

5.20.2

Host app

Sodalite

Platform

tvOS

OS version

26

Device / chip

Apple TV 4K

Playback path

Native AVPlayer

Source media (for playback bugs)

No response

Error codes / log lines


Anything else

No response

Activity

  1. added
    bug
    on Jul 23, 2026
  2. superuser404notfound commented on Jul 24, 2026

    @superuser404notfound
    Owner

    Thanks for the precise cold-launch report. The observed ordering points at the first hardware-deinterlace graph build rather than the #93 AVPlayer revive: the software live feeder can enqueue and arm audio first, then its first interlaced video packet synchronously enters yadif_videotoolbox setup; #93 does not run on this software-renderer path. The HDMI activation also completes before SoftwarePlaybackHost is created, so it cannot by itself explain audio already running before the video stall.

    Could you attach one complete cold-launch log with timestamps, from the first AetherEngine init line through the first video frame, plus the same-URL warm reload? The current release only logs after the deinterlace graph has fully configured, so I want the full boundary timing before moving the Metal warm-up off the first-frame path. I am tracing 5.20.2 now and will add stage timing if the existing log cannot isolate filter init vs graph config.

  3. superuser404notfound commented on Jul 24, 2026

    @superuser404notfound
    Owner

    Implementation for #203 is now available on branch fix/issue-203-software-cold-start at commit 1009885d.

    The traced cold-only stall is in the first yadif_videotoolbox graph setup, where FFmpeg synchronously creates the Metal compute pipeline before it can emit the first video frame. The fix starts one process-wide detached warm-up when AetherEngine initializes. For automatic deinterlacing, software playback waits for that shared warm-up before activating the renderer audio session and creating the software host. Forced software deinterlacing bypasses the wait, and a warm-up failure remains nonfatal so the real session can still attempt hardware and fall back to CPU.

    Local verification:

    • Issue Follow up 195 (cant re-open) #203 regression suite: 4 tests passed
    • Hardware deinterlace graph suite: 3 tests passed on Apple M1 Metal
    • Full suite: 981 tests in 162 suites passed
    • Strict Swift concurrency build with warnings as errors passed
    • Generic tvOS Simulator build for arm64 and x86_64 passed

    Could you test this commit on the physical Apple TV with:

    1. A force-quit followed by the first playback, repeated for two genuine cold launches
    2. A same-URL reload after each cold launch

    Please attach the complete timestamped logs for both cold launches and the warm reload, including these markers:

    • [Deinterlace] hardware warm-up started
    • [Deinterlace] hardware warm-up ready
    • renderer audio session active
    • first enqueue
    • seekClock
    • [Deinterlace] engaged [hardware]
    • first video frame enqueued

    I will keep the issue open until the physical-device retest confirms the cold-start timing.

  4. superuser404notfound commented on Jul 24, 2026

    @superuser404notfound
    Owner

    The fix is now released in AetherEngine 5.20.3:

    https://github.com/superuser404notfound/AetherEngine/releases/tag/5.20.3

    Both current consumers already pin the release commit 02eade9:

    • Sodalite main: b776431
    • AetherPlayer main: cf7459e

    Final verification is green:

    • 981 tests in 162 suites
    • strict Swift concurrency build with warnings as errors
    • tvOS Simulator build
    • GitHub CI on macOS, iOS Simulator, and tvOS Simulator
    • signed and notarized demo DMG attached to the release

    Please retest on the physical Apple TV with two genuine cold launches after force-quit, followed by a same-URL warm reload after each launch. The timestamped log markers requested above are still the useful evidence.

    I am leaving this issue open until your device retest confirms the cold-start timing.

  5. Simpendaal commented on Jul 24, 2026

    @Simpendaal
    Author

    Retested 5.20.3 on the physical Apple TV (tvOS 26.5), two parts: the cold-start fix is confirmed working, but I found what looks like a regression on the native path in the same session.

    1. Cold-start fix: confirmed. The warm-up now runs at engine init: [Deinterlace] hardware warm-up started → [Deinterlace] hardware warm-up ready after 0.808s. The first software-path session of the process (1080i50 H.264, AC-3) played immediately — renderer audio session active, [AudioOutput] first enqueue, [AudioOutput] seekClock to=34019.816 rate=1.0, [Deinterlace] engaged [hardware]: 1920x1080, [SWHost] first video frame enqueued all within about a second of load. The ~10 s wedge is gone.

    2. Regression: native-path live sessions never start playing. Live TS channels dispatched to the native path (progressive H.264 1080p50 + AAC → loopback HLS → AVPlayer) never produce a frame on 5.20.3. Three consecutive sessions on the same channel showed the identical pattern:

    Segments are produced and served normally, item.status=readyToPlay, layer.isReadyForDisplay=true at ~0.1 s.
    Then rate=1.0 but timeControlStatus=waitingToPlay forever — first AVPlayerWaitingWhileEvaluatingBufferingRateReason, then AVPlayerWaitingToMinimizeStallsReason — with the playhead stuck at 0.00 while ~5 s of forward buffer is available.
    Each session also logs failedToPlayToEndTime CoreMediaErrorDomain/-12642 shortly after readyToPlay.
    The same channel joined in 1.1–1.2 s with fastZap on the feat/ae195-fast-live-join branch on this same device, so this regressed somewhere between that branch and 5.20.3.

    Possibly related observations in the same log:

    The media playlist escalated mid-session from TARGETDURATION:1 / HOLD-BACK=3.000 / SODALITE-REFRESH:1 to TARGETDURATION:2 / HOLD-BACK=6.000 / SODALITE-REFRESH:10 (RFC 8216 §4.3.3.1: TARGETDURATION must not change within a playlist).
    One blocking playlist reload was answered with 503 reason=blocking reload msn=19 unsatisfiable.
    Software-path sessions in the same process play fine, so this is native-path specific. Device thermal state was serious during the test, but since the software path started instantly I don't think that's the blocker. Full timestamped log attached, covering a cold launch, the failing native sessions, and the working software session in between. Happy to split part 2 into a separate issue if you prefer.

  6. superuser404notfound commented on Jul 24, 2026

    @superuser404notfound
    Owner

    Thank you for the thorough physical-device retest.

    The reported timing confirms the original #203 root cause is fixed in 5.20.3: the hardware deinterlace warm-up completed in 0.808s, and the first software-path session reached audio, hardware deinterlacing, and its first video frame within about one second. The previous roughly 10s cold-start wedge is gone.

    The separate native loopback HLS symptom from the same retest is now tracked in #209. It is cross-linked with #208 because both involve native live-loopback startup policy, but the observed failing boundary differs: #208 withholds the first media playlist, while #209 already has a served playlist, media segments, and buffered content.

    Closing #203 as released and reporter-verified.

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