Skip to content

Live HDR10 master playlist rejected by AVPlayer (-1002), never falls back to media.m3u8 #130

Closed

Description

@digilearn-dev

What happened?

For live HDR10 channels, HLSVideoEngine.resolveUseMasterPlaylist correctly resolves useMaster=true (source is HDR, panel is HDR-ready) and serves a master playlist. AVPlayer fetches master.m3u8 twice, then the item fails with NSURLErrorDomain/-1002 "unsupported URL" — it never requests media.m3u8 at all.
I expected the item to reach readyToPlay the same way it does for non-HDR live channels on the same provider, using the same segment producer and codec path via direct media.m3u8 serving. Instead it fails outright before ever trying the variant playlist.
There's no fallback for this: #98 MasterFallbackDecision only handles -11868/-11848, and #35's cold-master readiness gate (reload master → then media) is explicitly gated to !options.isLive, so live HDR sessions that hit this have no recovery path at all.
Separately, I'd like to request a public LoadOptions flag (e.g. preferMediaPlaylist: Bool) that lets the host force the direct media playlist route regardless of resolveUseMasterPlaylist's internal decision. I confirmed matchContentEnabled=false does not do this in 5.0.5 — master routing only checks sourceIsHDR && panelIsInHDRMode; matchContentEnabled is stored/logged only (the old displaySupportsHDR && matchContentEnabled proxy was removed after the -11848 false-routing issue). A real override would let hosts route around cases like this without spoofing panel/HDR state.

Steps to reproduce

  1. Configure a live HLS ingest session (isLive: true) against an Xtream-style IPTV source serving genuine HDR10 UHD content (HEVC Main10, EAC3 audio, no Dolby Vision).
  2. Tune the channel with panelIsInHDRMode: true on an HDR-capable display, so resolveUseMasterPlaylist returns true.
  3. Observe: engine serves master.m3u8, AVPlayer requests it (twice, two connections), then AVPlayerItem.status goes to .failed with -1002 — media.m3u8 is never requested.
  4. Compare: the same provider's non-HDR channels (useMaster=false, served directly via media.m3u8) play correctly through the identical segment producer.

AetherEngine version or commit SHA

5.0.5

Host app

Custom / my own integration

Platform

tvOS

OS version

tvOS 26.6 (beta)

Device / chip

Apple TV 4K (A15)

Playback path

Native AVPlayer

Source media (for playback bugs)

  • Container: MPEG-TS (source) → remuxed to fMP4 by the ingest producer
  • Video: HEVC (HVC1), profile 2, level 153, 3840x2160, PQ (HDR10, no Dolby Vision)
  • Audio: EAC3, falls back to AudioBridge (stream-copy probe failed: Could not find tag for codec eac3 in stream Add option to route video via AVPlayer instead of AVSampleBufferDisplayLayer #1, codec not currently supported in container)
  • CODECS string served: hvc1.2.4.L153,ec-3
  • No FRAME-RATE attribute present on the EXT-X-STREAM-INF line (live probe couldn't determine frame rate before playlist build) — possible contributing factor, unconfirmed as root cause.

Error codes / log lines

[HLSVideoEngine] serving on http://127.0.0.1:PORT/master.m3u8
  (dvModeAvailable=false effectiveDvMode=false panelIsHDR=true
   displaySupportsHDR=true matchContent=true sourceIsHDR=true
   useMaster=true videoRange=pq dvVariant=none)
[HLSLocalServer] GET /master.m3u8 HTTP/1.1
[HLSLocalServer] master.m3u8 body:
  #EXTM3U
  #EXT-X-VERSION:7
  #EXT-X-INDEPENDENT-SEGMENTS
  #EXT-X-STREAM-INF:BANDWIDTH=50000000,AVERAGE-BANDWIDTH=25000000,
    CODECS="hvc1.2.4.L153,ec-3",RESOLUTION=3840x2160,VIDEO-RANGE=PQ,
    CLOSED-CAPTIONS=NONE
  media.m3u8
[HLSLocalServer] -> 200 /master.m3u8 bytes=213
[NativeAVPlayerHost] asset.load(tracks) ok ... count=0
[NativeAVPlayerHost] asset.load(duration) ok ... seconds=nan
[NativeAVPlayerHost] item.status=failed err=NSURLErrorDomain/-1002 'unsupported URL'
[NativeAVPlayerHost] item.error.underlying=CoreMediaErrorDomain/-1002
No GET /media.m3u8 appears anywhere in the session. master.m3u8 is requested twice (fd=27, fd=26) before the item fails — consistent with AVPlayer's fetch-2-3-then-stall pattern on master-level codec/variant rejection, not a relative-URI resolution problem (I diffed buildMasterPlaylistText's output against the working direct-serve path; the relative media.m3u8 reference resolves correctly against the master's own base URL, and Content-Type is identical — application/vnd.apple.mpegurl — on both routes).

Anything else

Fully reproducible on our end every time with this provider/channel combination. Happy to test a build against it if that's useful.

  1. Fix: extend fallback-on-master-failure to cover -1002 (in addition to -11868/-11848), and make it apply to live sessions, not just VOD (Loopback-HLS playback wedges under rapid repeated seeks; recovered clock diverges from the decoded frame #35's gate is currently !options.isLive).
  2. Stopgap (lower effort): a public LoadOptions.preferMediaPlaylist (or similarly named) flag so hosts can force the direct media route without touching panelIsInHDRMode/matchContentEnabled, which currently have no effect on this routing decision besides the one that does (panelIsInHDRMode) and which we don't want to spoof since it also drives legitimate DisplayCriteria/HDR handshake behavior.

Activity

  1. added
    bug
    on Jul 17, 2026
  2. superuser404notfound commented on Jul 17, 2026

    @superuser404notfound
    Owner

    Fixed in 5.5.1.

    Your hunch about the missing FRAME-RATE attribute was exactly right. I reproduced this locally with a byte-exact copy of your served master (same 213-byte playlist): AVPlayer fetches master.m3u8 twice, never requests media.m3u8, and fails with NSURLErrorDomain -1002, underlying CoreMediaErrorDomain -1002. Adding FRAME-RATE to the otherwise identical variant makes AVPlayer accept it and fetch media.m3u8. Removing VIDEO-RANGE does too, and VIDEO-RANGE=SDR without FRAME-RATE is also accepted. So the rule is: AVPlayer filters any VIDEO-RANGE=PQ/HLG EXT-X-STREAM-INF that carries no FRAME-RATE out of the master at parse time, and with a single-variant master it is left with nothing to load, which surfaces as -1002 "unsupported URL". It is not a tvOS 26.6 beta regression (it reproduces on current macOS) and not specific to your provider. The reason only live hit it: VOD probes reliably fill avg_frame_rate, your live TS probe did not, and the engine only read avg_frame_rate when building the manifest attribute.

    5.5.1 fixes it in three layers (43ce1f5):

    1. The master FRAME-RATE attribute now uses the same avg_frame_rate -> r_frame_rate fallback chain as the host probe. Live TS almost always carries r_frame_rate from the parser, so your channel should now serve a master with a real FRAME-RATE and play through the same HDR master route as VOD.
    2. If the frame rate is unknown even after the fallback, resolveUseMasterPlaylist routes media-direct instead of serving a master AVPlayer provably rejects. Deterministic pre-routing, no doomed first attempt, so tune-in stays instant.
    3. A startup -1002 while serving the master is now classified as a master rejection alongside -11868/-11848 and reactively falls back to media.m3u8, live sessions included (your request 1, extended beyond the display-rejection set). The live fallback rejoins at the live edge instead of replaying a stale start position.

    On request 2 (a public preferMediaPlaylist LoadOptions flag): holding off for now. Its motivating case was routing around this bug, and with layers 1+2 the engine makes that routing decision itself, deterministically, from the same information a host would use. A permanent public override would also silently disable the master-only features (native subtitle renditions, DV/HDR signaling) for adopters who set it defensively. If you hit another case where the master route misbehaves and you need an escape hatch before a fix lands, please open an issue with the log lines and I will revisit.

    Could you retest against 5.5.1? Your logs should now show either FRAME-RATE in the served master body, or useMaster=false with a direct media.m3u8 serve if the probe genuinely finds no frame rate. Either way the channel should reach readyToPlay.

  3. digilearn-dev commented on Jul 17, 2026

    @digilearn-dev
    Author

    Confirmed on device, retested against 5.5.1 — thank you for the fast turnaround.

    The channel now serves a master with a real FRAME-RATE attribute and plays through natively:
    #EXT-X-STREAM-INF:BANDWIDTH=50000000,AVERAGE-BANDWIDTH=25000000,
    CODECS="hvc1.2.4.L153,ec-3",RESOLUTION=3840x2160,FRAME-RATE=50.000,
    VIDEO-RANGE=PQ,CLOSED-CAPTIONS=NONE
    media.m3u8 is requested (previously never happened), readyToPlay is reached, HDR10 passthrough is confirmed via the video track (transfer=SMPTE_ST_2084_PQ), and ttff_ms for load_profile=live came in around 1.4–2.6s across several tune-ins — consistent with a normal live join, not the doomed-master path. I also caught one zap that landed on layer 2 (probe genuinely found no rate mid-zap, engine correctly routed useMaster=false direct-serve, still reached playback) — so all three layers are observably doing their job, not just the primary one.

    Agreed on holding off on preferMediaPlaylist — deterministic pre-routing from the same information a host would use is a better outcome than a manual override, and I'd rather not carry a flag that quietly disables DV/HDR signaling for anyone who reaches for it defensively. Appreciate you thinking that through rather than just shipping the easy ask.

    Since you offered to revisit if we hit another master-route case: we have, on the same live ingest path but unrelated to this bug — I'll open a separate issue with logs rather than piling onto this one, since it's a different mechanism (SPS/PPS/IDR timing on mid-stream joins, not master-playlist routing).

  4. superuser404notfound commented on Jul 17, 2026

    @superuser404notfound
    Owner

    Thanks for the thorough retest, and especially for catching a zap that exercised layer 2 with a genuine mid-zap probe miss. That is the path that is hardest to hit deliberately, so having all three layers observed on a real device is exactly the confirmation I was hoping for.

    With FRAME-RATE confirmed in the served master body, media.m3u8 actually being requested, HDR10 passthrough verified on the video track, and tune-in times in the normal live range, I am closing this as fixed in 5.5.1.

    The SPS/PPS/IDR mid-stream join report is tracked in #133 and I will follow up there.

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