Repository navigation
Description
What happened?
AetherEngine 7.33.2 cannot reliably play a finite HLS VOD from an origin whose media endpoint behaves correctly over a persistent HTTP/1.1 connection but inconsistently over HTTP/2 or multiple newly-created connections.
This is not a request to prefer HTTP/1.1 globally. It is a request for a source-scoped transport policy for media origins with demonstrated HTTP/2 interoperability or connection-affinity constraints.
Changing the Foundation receive primitive did not solve the problem:
URLSession.dataTasknegotiatedh2.URLSession.data(for:)also negotiatedh2.- Replacing each segment fetch with a raw HTTP/1.1 request proved the protocol difference, but opening a new connection per segment still caused refusals.
- Reusing one HTTP/1.1 keep-alive connection across consecutive segments was the stable path.
Why HTTP/1.1 is the correct player policy here
HTTP/1.1 is older—its widely deployed specification dates to 1999, while HTTP/2 was standardized in 2015—but protocol age is not the player's correctness criterion:
- HTTP/1.1 chronology: https://www.rfc-editor.org/info/rfc2616/
- HTTP/2 chronology: https://www.rfc-editor.org/info/rfc7540/
HLS does not require HTTP/2. RFC 8216 describes segments as URI-addressed resources carried over HTTP, or another protocol capable of reliably transferring the resource. It defines no minimum HTTP version:
Persistent reuse is part of HTTP/1.1 itself: multiple requests and responses can use one connection by default:
This is also established player behavior rather than an application-specific workaround. FFmpeg's HLS demuxer explicitly models http_persistent and calls open_url_keepalive to reuse an existing connection for later HLS requests:
For a player, "safe" here means predictable media delivery, sustained throughput, and buffer continuity. It does not mean that HTTP/1.1 is cryptographically stronger. HTTPS certificate and hostname validation remain required.
Reproduction evidence
The signed source URL and credential-bearing headers are private and intentionally omitted. All protocol comparisons below used the same segment, headers, and edge IP.
| Client / transport | Result |
|---|---|
| curl forced HTTP/2, run 1 | HTTP 403 after 1.69 s |
| curl forced HTTP/1.1, run 1 | HTTP 200, 4,103,664 bytes in 14.44 s |
| curl forced HTTP/1.1, run 2 | HTTP 200, 4,103,664 bytes in 15.19 s |
| curl forced HTTP/2, run 2 | HTTP 403 after 1.11 s |
Foundation data(for:), negotiated h2 |
One HTTP 200 run, followed by an HTTP 403 run |
A physical Apple TV run using AetherEngine's raw HTTP/1.1 transport confirmed:
api=held_http1
protocol=http/1.1
status=200
receivedBytes=4103664
elapsed=1.149s
bytesPerSecond=3571148
However, the current experiment creates a new HeldSourceConnection for every segment. The next batch opened several independent HTTP/1.1 connections and received HTTP 403.
A separate controlled comparison established the missing invariant:
one HTTP/1.1 keep-alive connection, four consecutive segments:
200 / 200 / 200 / 200
approximately 2.7–8.3 MB/s
four newly-created HTTP/1.1 connections:
at least one request immediately returned 403
Therefore, forcing the HTTP version per request is insufficient. The connection lifetime must belong to the HLS playlist/ingest session and span segment boundaries.
Expected behavior
AetherEngine should provide a source-scoped HLS transport policy that can:
- use HTTPS while pinning the wire protocol to HTTP/1.1;
- retain normal TLS certificate and hostname validation;
- reuse the same persistent connection across consecutive same-origin segment requests;
- preserve the exact segment URL, query, headers, redirects, and response framing;
- make the selected protocol and connection reuse observable;
- retain bounded response-body handling, cancellation, and typed transport errors;
- obey an explicit server close or origin change;
- avoid silently falling back to h2 when HTTP/1.1 was explicitly selected;
- leave the default transport behavior of ordinary HLS sources unchanged.
This policy should not be implemented as a QueryWrapped-specific downloader. QueryWrapped admission is a separate concern.
AetherEngine version or commit SHA
7.33.2 / e7afcfad3973426a6ffff31fc111f6b1e5078061
Host app
Custom integration using SyncnextHybrid's diagnostic smoke player.
Platform
tvOS, physical Apple TV 4K.
Playback path
Native/loopback path through the AE#268 seekable HLS VOD ingest.
Related issues
- One request per 32 MB gets me rate limited, and a 429 then kills the session for good #377 established the need for a held persistent source connection, but its lifecycle is for one resource rather than successive HLS segment URLs.
- HEVC-in-MPEG-TS HLS VOD direct media playlist routes to AVPlayer with 0x0 video #268 introduced the seekable HEVC-in-MPEG-TS VOD ingest used by this reproduction.
Activity
qoli commentedon Oct 10, 2026
Companion issue #733 tracks QueryWrapped admission only. This issue is intentionally limited to the HLS transport policy and cross-segment persistent HTTP/1.1 connection reuse.
Merge branch 'feat/hls-persistent-http1' (#732)
feat(hls): persistent HTTP/1.1 transport for the HLS VOD ingest under…
superuser404notfound commentedon Oct 12, 2026
Released in 7.35.0: the persistent HTTP/1.1 transport for the HLS VOD ingest under
heldSourceConnection(37370623, merged in60f5cc9e). Every connection open and close is logged with its protocol and request count, so a log from the affected origin shows directly whether the session stayed on one connection.qoli commentedon Oct 16, 2026
Verified the explicit persistent HTTP/1.1 policy on the original ONE source on 2026-10-16, using a physical Apple TV 4K (AppleTV6,2), tvOS 26.6, and HybridSmokePlayer in direct
aetherEnginemode.Setup
c6365cc3c8850bdb670654ca26dcd21f73670875, with FFmpegBuild 3.7.1.PersistentHTTP1Transport,HLSVODIngestReader,AVIOReader, and the relevant fetch/probe files were byte-identical to official 7.36.0.LoadOptions.heldSourceConnection = truebefore loading the current ONE plugin's URL and headers. No transport implementation or timeout was changed. The original outer query-wrapped segment URLs were preserved.The upstream log confirms the selected protocol and repeated requests on each connection (origin redacted):
Reposition/cancellation replaced connections; they were not opened afresh for every segment. After the last reopen, no further connection opened while the buffered media position reached 130 s and visible playback continued to 148 s across multiple approximately 10 s source segments. Together with the unchanged sequential ingest, this verifies cross-segment reuse for this run. The final connection stayed active, so its final request count was not emitted or inferred. No h2 transport appeared in this run's console.
Physical-device result: PASS
Run
e98ee3c9-7a49-46c3-b799-a5a2fb8e55ea:The default-policy #733 run was kept separate:
heldSourceConnectiondefaults to false, so an h2 result without enabling it does not test #732. This explicit-policy run confirms HTTP/1.1, connection reuse, startup, seeking and continued playback on the affected source.Closing as completed for the reported reproduction. This is a bounded real-source smoke acceptance, not exhaustive qualification of redirect/origin-change/TLS/stale-connection edge cases. Signed URLs and header values remain private.
superuser404notfound commentedon Oct 16, 2026
Thanks for the careful verification on the original source, and for keeping the default-policy #733 run separate. The connection log reads exactly as intended: one HTTP/1.1 connection carried across segments, replaced only on reposition. Agreed on the scope, redirect, origin-change and stale-connection behavior were not part of this run; if one of those shows up on a real source, a fresh issue with the
AE#732 connectionlines is the fastest way in.qoli commentedon Oct 16, 2026
Reopening: HTTP/1.1 is selected, but sustained playback exposes a serious segment-delivery implementation issue
Follow-up to my earlier acceptance comment and the confirmation above: the protocol selection and normal cross-segment reuse were verified in that bounded run. Subsequent three-title paired physical-device tests found readiness failures and a reproduced late playback stop while the 7.36.0 ingest was still using HTTP/1.1. This blocks our downstream Hybrid 7.36.0 promotion. I am reopening #732 to track the held HLS transport's delivery, timeout and cancellation semantics; the #733 admission fix is a separate result.
Setup and scope
hybridAVKitmode with native AVPlayer presentation andLoadOptions.heldSourceConnection = true.c6365cc3c8850bdb670654ca26dcd21f73670875, FFmpegBuild 3.7.1, without downstream 0005. Existing local-dependency/independent-audio/fingerprint patches 0001/0002/0004 remain; this is not a pristine build. The two transport owner files discussed below are byte-identical to official 7.36.0.e7afcfad3973426a6ffff31fc111f6b1e5078061, FFmpegBuild 3.7.0, with the exact unchanged downstream0005-query-wrapped-hls-segment-ingest.patch(SHA-2569cb48dfdff84aa917a0ca89833c37d12295246460b4b88e8ea1a5fa0ed4eb8e3). Hybrid's host binding, held option and observation sources are identical between arms; each version used a fixed signed binary throughout.Player()and locally verified complete media download plus sampled A/V decode. Later arms shared their pair's decoded sample after fresh URL/header and playlist-content checks, to avoid another full-media prefetch.Three paired results — 2026-10-16
Readymeans elapsed run-start to the finite paused/seekable session becoming ready.Advance at +120means source-time advancement from the actual seek landing over the next 120 wall-clock seconds. The failed third-title arm uses its terminal snapshot plus the late frozen native frames, not an invented +120 event.All four runs that reached playback landed exactly at 10.000 s and returned 47 PCM buffers / 240640 frames covering source 0.000–5.013 s. The short smoke passed before the third-title 7.36.0 failure; the continued observer subsequently changed the result/UI to FAIL.
The third-title failure's upstream evidence, with origin redacted:
The host then reported
player_failed,stage=post_smoke_observation, source time22.742, withSource read failed (code -1). This correlates the generic playback failure with the ingest timeout; it does not by itself identify which timeout policy fired.Concrete implementation differences
These concern the successful-response media-body path, beyond HTTP version selection:
primedSegmentfor producer reusestreamSegment→PersistentHTTP1Session.stream→QueryWrappedSegmentSink.receive; body chunks up to 64 KiB enter the FIFO while the response is still arrivingPersistentHTTP1Transport.getaccumulates a complete responseData;ingestSequentiallycallsappendonly after it returnscancelSessionOnTaskCancellation: false; the superseded sink discards old-generation bytes while the serial transport drains the response, preserving the socket for the next requestVerified upstream locations: sequential full-segment delivery, whole-first-segment probe, deadline constants, exchange and cancellation, body accumulation.
Why this matters for slow large segments: the second title's first segment is 16,180,032 bytes. At 100,000 bytes/s it needs about 162 seconds to complete. Streaming delivery can already feed the demuxer/remuxer while bytes arrive; it still cannot guarantee playback if sustained throughput is insufficient. The 7.36.0 path provides none of that segment to the FIFO before completion, and its 45 s exchange ceiling prevents this slowly progressing response from completing. Even ignoring overhead, that segment needs about 360 KB/s to fit the deadline. This delays the availability of each segment until completion; existing buffered media can hide that wait, but an empty FIFO receives none of the currently arriving segment. The deadline can turn an active-but-slow download into a terminal failure.
That is a direct consequence of the code. It is not a claim that every observed Code 60 was proven to come from the 45 s ceiling, rather than the per-read timeout or another transport condition.
Traffic evidence and limits
Read-only localClash observations showed every correlated TV origin flow selecting
Match → DIRECT, chain[DIRECT]; both playback ingests logged HTTP/1.1. No routing/DNS/proxy settings were changed.Those rates include player read-ahead/backpressure and idle time; they are not link-capacity measurements. IPv4 was slow in one pair and fast in another; the same IPv6 peer was fast in pair 1 and slow in pair 3. The first pair favors 7.36, so this is not evidence that 0005 always wins.
The Mac also reproduced large variation with the same persistent HTTP/1.1 IPv6 probe: a complete 16.18 MB segment in 1.217 s with A/V decode, then only 9,568,256 B in 120.597 s on a later full-body attempt. The latter remains a failed check. A separate 7.36 TV attempt received source HTTP 404 before ingest and is excluded from the transport comparison. Fresh manifests could change nested query parameters while retaining the same outer source URL and media paths. Three distinct titles and reduced repeated prefetching mitigate cache bias; they do not prove cold CDN caches. Version/FFmpeg differences, remote peers, source availability and timing mean this is a historical reference comparison, not isolated single-patch causality proof.
Requested implementation follow-up
Source read failed (code -1)alone hides the actionable cause.A deterministic throttled fixture (16.18 MB TS segment at ~100 KB/s, plus a seek during its body) would separate these implementation semantics from the live CDN's variation. The unchanged 0005 patch does not apply directly to 7.36.0; the recommendation is to use its streaming and drain/preserve behavior as a reference for the generic source-scoped transport, not to adopt its query-wrapped admission rule.
The earlier bounded protocol/reuse PASS still stands, but sustained Hybrid playback is not accepted. #732 needs to remain open for this implementation follow-up. Signed playback URLs, query values, header values, device identifiers and raw private logs are intentionally omitted.
fix(hls): review follow-ups for the streamed persistent ingest (#732)
Merge pull request #816 from superuser404notfound/fix/732-streamed-se…
superuser404notfound commentedon Oct 17, 2026
Thank you for the paired runs and for the source pointers, they made this quick to pin down. The analysis holds, and one detail sharpens it: the
Code=60is the 45 s exchange deadline.read()set the socket read timeout tomin(30 s, time left before the deadline), so when the deadline ran out,URLSessionStreamTaskraised its own POSIX timeout instead of the transport'sdeadlineExceeded. A loopback reproduction shows exactly that shape: 11.6 MB segments at 200 KB/s, and onmainthe carriage probe died at 45.1 s withNSPOSIXErrorDomain Code=60after 8.2 of 11.6 MB, after which the session left the ingest.PR #816 is merged to
main(17215ee4c6029b4e7179450589ac2ea83a8af2b7) and addresses the four requests:body stalled, no bytes for 30 s after <received>/<expected> bytes in <elapsed> s, and a missed head deadline is reported as such. Connection events are logged:draining abandoned body, <progress>,drained, kept for the next request,closed after N requests reason=abandoned mid-body, <progress>, plus a per-request line with status, bytes, elapsed time and reused/fresh at verbose level.Loopback measurement with a keep-alive origin rate-limited across all its connections, 3 x 60 s HEVC-in-TS segments of about 11.6 MB:
Code=60, session left the ingestThe deterministic fixture suggested here is in the test suite: a slow segment readable before it completes, a seek during a slow body (drained or closed, never two connections at once), a stall carrying its progress, and a steady slow body that outlives the read timeout without being cut off.
One limit that remains: the engine's two repositions onto segment 0 right after the open still cost one connection each. This was already the case before, and now they abandon a few hundred KB instead of whole segments. Also note that wall-clock numbers from loopback are not a device result.
This is not in a release yet. For a device run before one,
17215ee4can be pinned directly. The issue stays open until sustained Hybrid playback on the real titles confirms it.fix(hls): stream segment bodies on the persistent HTTP/1.1 ingest, no…
docs(changelog): unreleased TrueHD path and the superuser404notfound#732
superuser404notfound commentedon Oct 19, 2026
Released in 7.40.0: the streamed segment bodies on the persistent HTTP/1.1 ingest (
17215ee4, PR #816) are in that tag and in 7.41.0, so a retest no longer needs a pinned commit. The issue stays open until sustained Hybrid playback on the real titles confirms it.qoli commentedon Oct 23, 2026
Physical Hybrid acceptance evidence — 2026-10-24
Retested the same three ONE title/episode selections on a physical Apple TV 4K (AppleTV6,2), tvOS 26.6, with the standalone HybridSmokePlayer. All three accepted runs passed startup, a 10-second seek, and a further 120 seconds of media progress after initial seek recovery. This supplies the device evidence for the completed closure.
Build and configuration
52802afaaf035a7f729bba1043b640ad4d9ebb3e; FFmpegBuild 3.9.0,3b398c8f6340fe5fb4a7cb9a2a211a16677171e0.4b2d72cfbbad7a988a7e3d6fc1fe3cf9f0f0bc1c, plus local diagnostic-host changes to forward the explicit held-source option and delay terminal PASS until sustained observation finishes. No additional transport policy, timeout, concurrency or retry change was made for this acceptance.Package.resolveddiffering.heldSourceConnection=true,hybridAVKit, playback rate 1, seek target 10 seconds. The accepted runs all retainedavKitProxyand matching AVKit controller binding. Xianni/Mushenji asserted that route upfront; Jianlai used the existing observe-selected-route mode, which then requires the selected route to remain unchanged.Device results
Startup required at least 2 seconds of actual media progress. Seeking used the AVKit user-navigation entry (
seek_input=avkit_user_navigation). After initial post-seek recovery, the observer required another 120 seconds of media advancement and rejected player failure, early EOS, route/binding drift or failure to reach the target within its deadline.Selected fields from the saved structured terminal events, annotated with the corresponding title:
{"event":"sustained_playback_passed","runID":"54692ad6-2c96-4890-bbc8-9923f94bf7e8","title":"剑来第2季 E01","phase":"playing","progress_seconds":"120.000","elapsed_seconds":"120.046"} {"event":"sustained_playback_passed","runID":"0ed07f6d-61a4-4d84-ac03-e423a101337b","title":"牧神记 E01","phase":"playing","progress_seconds":"120.079","elapsed_seconds":"120.174"} {"event":"sustained_playback_passed","runID":"27b2167b-c799-4f2f-b5ec-6c9e816360d3","title":"仙逆 E162","phase":"playing","progress_seconds":"120.127","elapsed_seconds":"120.768"}Each run subsequently emitted
run_passed. Native device PNG pairs were inspected and showed different actual video scenes, with visible media times Jianlai 01:48 → 02:07, Mushenji 01:47 → 02:03, and Xianni 01:47 → 02:04; no spinner or error was visible in those captures. A further Jianlai capture showed green PASS,playing, at 02:22. These frame observations supplement the structured clock/progress evidence.HTTP/1.1 connection evidence
Xianni and Jianlai each opened only
vod#1; both initial reposition cancellations drained their responses and kept that connection. Xianni excerpt, origin redacted:Mushenji's two initial repositions exceeded the existing 2 MiB drain budget, so those connections closed;
vod#3then carried the sustained run:After these initial repositions, no further connection opened during the sustained playback windows. Continued HLS ingest across segments on those unchanged connections supports cross-segment reuse. The final connections remained active until the host was stopped, so no unprinted final request count is inferred. No h2 media ingest, HTTP 403, body-stall error or terminal source-read failure was observed in the three accepted runs.
Focused tests and retained limits
swift test --package-path AetherEngine --filter Issue732PersistentHTTP1Tests: exit 0; 20 XCTest checks plus 12 parameterized segment-boundary admission cases passed, covering connection reuse, delivery before full-body completion, progressing slow bodies, stalls, seek drain/close, framing and redirects.request-failed, then entered the HTTP/1.1 ingest with native presentation and stopped on the proxy-route assertion. The accepted Jianlai rerun positively classified HEVC and kept the proxy route throughout. The intermittent admission-probe failure's root cause remains unconfirmed; no production behavior was changed to hide it.This is bounded sustained-playback acceptance for the three reported source selections. Full-movie EOS, audible audio, HDR panel behavior, controlled physical-device throttling and TLS fault injection were not exercised. Original playback URLs, header values, device identifiers and full private logs remain local.
The three-source sustained Hybrid retest passes within this scope, supporting the completed closure of #732.
test(hls): keep the persistent-HTTP1 reader's blocking calls off the …
test: deflake the three tests that kept main red (superuser404notfoun…
fix(hls): read the socket once before a head deadline spent waiting f…
test: seek only once the client reads the segment's body (#732 deflake)