Skip to content

dumpPlayerItemTracks freezes the main thread ~4 s on first playback #735

Open

Description

@Rasmusmart57

7.33.2, tvOS 27, Apple TV 4K, native route, first playback after launch.

Right at readyToPlay the main thread hangs for about 3.8 s. Video keeps playing but our UI freezes, so the timeline stops and then jumps. A watchdog caught this stack:

assetTrack.load(.formatDescriptions)
CMAudioFormatDescriptionCreate
AudioComponentFindNext
GetAudioDSPManager
dyld

It comes from dumpPlayerItemTracks, which runs in a Task { @MainActor }. The first audio format description in a process makes dyld load the audio DSP stuff, and that takes a few seconds. After that it's fast.

Since it's just logging, maybe it could run off the main actor? For now we create one E-AC-3 format description in the background at launch, which gets the load out of the way. With that the hang is gone.

Activity

  1. superuser404notfound commented on Oct 12, 2026

    @superuser404notfound
    Owner

    Thanks for the stack, it pointed straight at the cause. Released in 7.35.0 (6286d0e9).

    dumpPlayerItemTracks was only half of it. Since the 26 SDKs, AVAsset.load(_:) takes isolation: isolated (any Actor)? = #isolation and runs on the caller's actor, so every load(.formatDescriptions) in NativeAVPlayerHost ran on the main thread. publishDetectedAudioTracks reads the same descriptions at the same readyToPlay, so moving only the dump would have moved the hang there. All seven reads now go through one helper that runs the load on the engine's blocking executor (GCD), so the one-off dyld load of the audio DSP stack happens off the main thread. The logged and published values are unchanged.

    Keeping your launch-time E-AC-3 warm-up does no harm, but it should not be needed on 7.35.0. If you can drop it for one cold launch and confirm the watchdog stays quiet, that would settle it.

  2. cmcpherson274 commented on Oct 16, 2026

    @cmcpherson274

    A data point from tvOS 26.6 for the cold-launch question: on our Apple TV the hang did not show before the fix, so our runs cannot confirm 7.35.0 one way or the other.

    Our Apple TV 4K (3rd generation, AppleTV14,1), tvOS 26.6, Debug builds of our app, the native path through our loopback route; every run starts a fresh process. The measure is the time from the first [NativeAVPlayerHost] #N item.status=readyToPlay of a process to that item's #N item.audioTrack … (readyToPlay) line, which is logged after the first audio format-description load:

    engine processes median 90th percentile max 0.5 s or more
    7.15.1 to 7.28.3 (25 September to 13 October) 596 5 ms 8 ms 158 ms 0

    From 7.35.0 that load runs off the main thread, so the measure no longer applies there. We have not run a device on tvOS 27.

    7.35.1 is our app's engine pin as of today (2026-10-16); 7.36.0 is the candidate, measured beside it.

  3. superuser404notfound commented on Oct 16, 2026

    @superuser404notfound
    Owner

    Thanks, that is a useful baseline. 596 cold processes on tvOS 26.6 with a 158 ms worst case means the multi-second dyld load is not something every first audio format description pays; the 3.8 s in the report came from tvOS 27, so it looks tied to that release (or to that device's state) rather than to the engine path itself. Either way the load no longer runs on the main actor from 7.35.0 on, so neither OS can stall the UI there.

    Keeping this open for a cold launch on tvOS 27 without the E-AC-3 warm-up.

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