Repository navigation
Description
What happened?
Hi, and thanks for the engine. I'm using it in Lumen, a Plex client for Apple TV and iPhone. I've been chasing a Live TV problem on Plex's free channels and I think it ends up in the engine, though I may have the cause wrong, so please treat the explanation below as my best guess. The logs are the useful part.
These channels are ad-stitched HLS. At some breaks the stream announces a discontinuity and its clock restarts near zero. The engine seems to read that as a wrap, gets a value just over 2^33 (8590114592 is 2^33 + 180000), decides the source is replaying old content, and reopens. The discontinuity seam is logged just before it each time, so the jump was announced.
What I see depends on the channel:
- Sound lost (Dragons' Den, MediaTailor ads, AAC). There's one reopen when the break starts, and the picture then freezes for about 40 s. There's a second reopen when the programme returns. After that, video gets a timeline rebase but no audio rebase is logged, and the segments carry sound=none. The picture carries on, but there's no sound at all. AVPlayer reports playing, volume 1.0, not muted, one audio track enabled, no errors. Sometimes a later ad break brings the sound back.
It happened the same way in a simulator run in full screen, so Picture in Picture isn't needed, even though I first noticed it there. That's why I think it's the sequence rather than the output.
-
Looping (Kim's Convenience, Xumo, with short bumper clips between ads). The reset fires on audio here, and the engine reopens about every 2 s, six times in 9 s. Each reopen hits the same bumper and the viewer watches the same clip go round until the adverts take over. liveSourceReset isn't published, so the app can't step in.
-
Fine (River Monsters, Amagi). It gets the same reset once, reopens once, and keeps its sound. So one reopen seems harmless, and the trouble comes with repeats.
What I'd expect: an announced discontinuity with a clock restart gets handled as a normal seam, with sound and picture rebased together and no reopen. If a reopen is still needed, sound shouldn't stay missing afterwards, and repeated replay reopens should stop and publish liveSourceReset.
Steps to reproduce
- Load an ad-stitched live HLS channel with isLive = true, nativeRemoteHLS = false, dvrWindowSeconds = 1800.
- Keep playing through a few ad breaks. On Dragons' Den, sound drops as the programme returns after a break, though not at every break. It also happens in the tvOS simulator.
- On Kim's Convenience, the same clip loops at the bumpers between ads.
I can't share the stream URLs because they're tied to a Plex account, but I can send fuller logs.
AetherEngine version or commit SHA
7.58.0
Host app
Custom / my own integration
Platform
tvOS
OS version
tvOS 27.3
Device / chip
Apple TV 4K (AppleTV14,1), also the tvOS simulator
Playback path
Native AVPlayer
Source media (for playback bugs)
Live HLS (MPEG-TS segments), H.264 1920x1080 or 1280x720, AAC stereo 48 kHz, SDR. Ad-stitched free channels from Plex.
Error codes / log lines
Dragons' Den, sound lost:
11:01:17 [HLSSegmentProducer] live source AXIS RESET detected on video: srcDts=8590114592 (wrap-corrected raw=180000) firstSeenDts=1741926440 jumpTicks=+6848013978; source renumbered its 33-bit clock from zero and is re-sending content already played, exiting pump for host retune
11:01:17 [HLSVideoEngine] live pump exited (reason=sourceReplay); starting reopen
11:01:20 [HLSVideoEngine] live reopen succeeded on attempt 1: continuing at seg112 (outputEnd=111.2s)
11:01:20 [HLSSegmentProducer] video gate open: actual=3423240 anchorPts=3426243 target=-9223372036854775808 desired=10011912 pinnedTo=3423240 shift=0 presentedShift=-6585669 lead=3003 videoPID=0 reconstructed=false
11:01:20 [HLSSegmentProducer] audio gate open: actual=3426723 target=3423240 desired=10011912 shift=0 gapMs=0.0
11:01:20 [HLSSegmentProducer] source stopped carrying timestamps on the audio stream; synthesizing at 1920 ticks/packet (0.0213s). The live cutter reads this timestamp, so its segments are paced by it from here on
11:01:20 [HLSSegmentProducer] video timeline rebase (live): jumpTicks=1737247946 srcDts=1741926440 lastSrcDts=4678494 oldShift=0 newShift=1737244943 continuationDts=4681497
then seg-119 onwards: sound=none
Kim's Convenience, looping:
12:10:44 [HLSSegmentProducer] live source AXIS RESET detected on audio: srcDts=8590114592 (wrap-corrected raw=180000) firstSeenDts=68708190 jumpTicks=+1461531392
12:10:46 pump finished: reason=sourceReplay packetsRead=1230 packetsWritten=471 elapsed=276ms
12:10:48 pump finished: reason=sourceReplay packetsRead=1218 packetsWritten=459 elapsed=274ms
12:10:50 pump finished: reason=sourceReplay packetsRead=1218 packetsWritten=459 elapsed=273ms
12:10:51 pump finished: reason=sourceReplay packetsRead=792 packetsWritten=315 elapsed=201ms
12:10:53 pump finished: reason=sourceReplay packetsRead=792 packetsWritten=315 elapsed=192ms
Anything else
For comparison, I played Dragons' Den with nativeRemoteHLS = true and no DVR window for 25 minutes in the simulator. It had no stalls or pauses, and I could hear it carry on through breaks where a TV running the normal setup lost its sound. That's listening rather than a measurement, but it suggests the stream itself is playable.
Separately, I've got the app answering liveSourceReset now, so that side is covered.
Activity
quint-aether commentedon Nov 6, 2026
This looks related to #405 (closed), which also dealt with a wrap-corrected live TS restart being taken for a source replay. Your logs are from 7.58.0 and show the same
AXIS RESET/sourceReplaypath firing on announced discontinuity seams, so this will go to the maintainer as a live ingest bug.Since you offered fuller logs, these two would help most:
sound=nonesegments.liveSourceResetaround 12:10:53.Automated triage by Quint (Claude). A maintainer reads every issue and will follow up.
psykix commentedon Nov 6, 2026
Thanks. Both below, with stream URLs trimmed and some player noise taken out (play/pause status, access log, placement audit).
One catch on the Dragons' Den log: my app filters the per-segment lines to save space, so you won't see each
sound=nonesegment. The[LiveTV] no sound for 8 segmentsline is that filter counting them, and it counts only segments marked sound=none. The[LiveTV] sound back after 15 segmentsline is a false alarm from my filter, because seg-134 had no sound= field at all. The sound didn't come back there. I've corrected that since.Something that stood out reading it again: after the second reopen the video gate opens with
pinnedTo=3423240 shift=0, and from then on segments start around 59 s (seg-126 start=59.090s), although the reopen saidoutputEnd=111.2s. Noaudio timeline rebaseappears anywhere in this stretch. Kim's Convenience also opens withpinnedTo ... shift=0on its last reopen at 12:10:55. I don't know if that's the cause, but it looked odd.On Kim's, there's no line about a reopen budget, and no
liveSourceReset, between 12:10:43 and 12:10:55. Every reopen sayssucceeded on attempt 1. The same pattern repeats through 12:10:53, then it plays on.liveSourceResetonly arrived later, at 12:13:02, from a no-cut stall (reason=segmentStall). I've shown the first two rounds; the rest look the same apart from the numbers, and I can send them if useful.Dragons' Den, second reopen to first sound=none (long lines shortened)
Kim's Convenience, first two rounds of reopens (long lines shortened)
psykix commentedon Nov 6, 2026
I went through the source and I think I've found why the sound goes on Dragons' Den. It isn't really the rebase after all, so ignore that part of my first post.
The programme and the ads carry their audio on different PIDs. I pulled the actual segments named in the report and probed them:
So video stays on one PID and audio doesn't. If a reopen lands inside an ad, the demuxer opens with just those two streams, which is what the log shows on the failing reopen and not on the good one:
audioConfig.sourceStreamIndexis then bound to the ad's audio. When the programme comes back, FFmpeg gives 0x1e2 a new stream index. Concatenating one ad segment and one programme segment and running ffprobe shows it:The
isAudioPktcheck in HLSSegmentProducer compares against the bound index, so every programme audio packet falls through as a foreign packet. That would explain all of it:Probing the other way round (programme first, then ad), the ad's audio didn't appear as a stream at all, so a session opened in the programme may be silent through the ads too. I haven't confirmed that in the engine itself.
A fix might be to follow the audio across a seam: after a discontinuity, if a new stream turns up with the same codec, sample rate and channel count, rebind to it, then let the normal seam handling line up the timestamps. I've not tried it, so you'll know better whether that's safe.
This doesn't cover the looping on Kim's Convenience, which still looks like the replay detection from the first post. The segment files for the ad and programme above are publicly fetchable for now, if the URLs would help.
superuser404notfound commentedon Nov 6, 2026
Thank you for the logs and especially for the PID probe, which pinned down the second fault exactly. Both faults are fixed on
main(mergeb9dd696b, not in a release yet).Looping and the reopen at the break. The clock restart behind
EXT-X-DISCONTINUITYreached the producer wrap-corrected (2^33 + 180000), and the #405 check read it as an origin that had restarted and was re-sending old content. That check was written for a continuous transport stream, where such a jump does mean a restart. On HLS ingest a clock restart at an announced discontinuity is legal and routine, so for segmented live sources it now goes through the ordinary timeline rebase, with video and audio rebased together and no reopen. A raw TS source keeps the #405 behaviour. A real replay after a reconnect is still caught by the exact payload match.Sound lost after the break. Your analysis was right. The audio track was bound to one stream index, and the programme's audio on
0x1e2arrived under a new index after the seam and was dropped as foreign. The producer now follows the audio to the new stream when two things hold. The bound stream must have gone quiet across a video seam (or for a full second without one). The new stream's ADTS frames must also match the track's AudioSpecificConfig (object type, sample rate, channels). A stream that was bound before, such as the programme coming back after an ad, is taken back on its first packet. The other direction (session opened in the programme, ad audio on its own PID) is covered by the same rule. The log line to look for isaudio follows the source to stream N. This covers stream-copy ADTS AAC, which all three channels use. A bridged track or another codec logsnot followedonce instead.A test in the engine reproduces both shapes. It uses a programme segment on one audio PID and an ad segment on another, with the clock restarted, once placed so that FFmpeg produces the same
2^33 + xvalue as your trace.One expectation from the report is not part of this change: repeated replay reopens on a raw TS source are still not capped by a budget that publishes
liveSourceReset. On these HLS channels that path no longer fires.When a release with this is out, a retest on Dragons' Den and Kim's Convenience would be very welcome. Leaving the issue open until then.
psykix commentedon Nov 6, 2026
Thanks, I tried main at b9dd696 on an Apple TV 4K (tvOS 27.3), Dragons' Den, joining during an ad.
The follow itself works:
But the audio axis then runs away. Straight after, the producer logs a stream of independent rebases, 141 in 73 s, nearly all the same size:
srcDts steps 30720 ticks each time (16 AAC frames at 1920 ticks, so several frames per PES on the programme's PID). lastSrcDts stays about 430080 ahead of srcDts, so the same jump fires again on every PES. The shift keeps dropping, and the sound moves ahead of the picture:
That's about 110 s ahead. The session had already logged this on the ad's stream, before the follow:
So my guess is that the synthesizer state from the ad carries across the follow, and the programme's multi-frame PES then disagrees with it. I haven't confirmed that in the source.
AVPlayer also logs -12888 (playlist unchanged) at 19:50:25, 19:50:43, 19:50:59 and 19:51:19, and the edge verdict ends up behind=172.34s playhead=62.58s edge=234.92s.
What it looked like on the TV: the sound carried on past the ad, as far as the programme's countdown timer, so the follow is doing its job. Then the picture froze as the programme resumed. Since the live cutter is paced by the audio timestamp, the runaway axis may be what stalls it.
I can send the whole stretch if it helps. Kim's Convenience not retested yet.
superuser404notfound commentedon Nov 7, 2026
Thank you for the retest and the exact numbers, they led straight to it. Your guess was close: it is the timestamp synthesizer, but the stride it learns from the programme stream is the problem, not state left over from the ad.
The programme PID packs 16 AAC frames into each PES, and only the first frame carries the PES timestamp. The producer learned the frame stride from the gap between two genuine timestamps, which here spans 16 packets (30720 ticks), and then applied that whole gap to each of the 15 timestamp-less frames. So the synthesized run ended 15 × 30720 = 460800 ticks past the PES start, the next genuine stamp arrived 430080 ticks behind it, and that read as a backward boundary. That is the independent rebase on every PES in your trace, each one pulling the audio shift lower until the sound ran about 110 s ahead.
Fixed on
main(mergec9ff2148, not in a release yet). The gap between genuine timestamps is now divided by the number of packets it covers, so the stride on that PID comes out at 1920 ticks. The follow also drops the previous stream's last timestamp, so the first stamp on the new stream does not start the measurement. A test replays the field shape (16 frames per PES, stamp on the first only) and checks that the synthesized run never passes the next genuine stamp. It failed with the reverse jump before the change.The frozen picture and the
-12888reloads look like the same fault downstream: the live cutter is paced by these timestamps, so a runaway audio axis can hold back the segments the playlist is waiting for. I have not confirmed that separately. If it still happens with this build, the log lines around the freeze would help.A retest on Dragons' Den (joining during an ad again) would be very welcome, and Kim's Convenience whenever convenient. Leaving the issue open until then.
psykix commentedon Nov 7, 2026
Retested main at 6b3ac97 on an Apple TV 4K (tvOS 27.3), Release build.
Dragons' Den, joining during an ad: works great. The sound carries through the ad and back into the programme, and the picture no longer freezes.
Kim's Convenience shows a different stall, at the seam from the programme's bumper into the ad pod (the second segment is a beacon URL):
The forced cut after the parameter-set change never finalizes. A retune joins about 20 s behind live, before the same seam, and wedges in exactly the same way at 09:39:16 (same jumpTicks, same window video=28 key=1 audio=66). So for the viewer the ad plays twice and then the picture freezes. I can send the whole stretch if it helps.
superuser404notfound commentedon Nov 7, 2026
Thank you for the retest and for checking the retune as well. That it wedged at the same seam with the same window both times pointed at something deterministic.
A clock restart is not the problem on its own. What happens is this. At a seam, the outgoing segment's last video PES can reach the demuxer truncated. The replay guard holds a packet like that as a damaged boundary until it can tell whether the source is replaying. The clock restart behind it then rebases the timeline, and the rebase resets the guard. The guard stopped holding at that point, but the producer still had the packet buffered. From there on it treated every later packet as part of an overlap that no longer existed and buffered those too. Nothing reached the cutter until the no-cut watchdog retuned 10 s later. That also explains the numbers in your trace: the watchdog counts the buffered packets as read (
sinceFinalize=817) but not as video or audio (video=28 audio=66), so it reads as a cutter wedge.Fixed on
main(merge90caa0af, not in a release yet). A seam now forwards the held packets before the guard starts over. If the seam is a video one, it drops them instead, since they are the outgoing programme's last pictures and would land behind the new programme's first frame. A test reproduces it with a source that stays open the way a live one does. Without the fix it ends insegmentStallafter the seam. With it, the seam is cut through right away. The earlier tests had missed this, because the end of their input released the buffer.One thing I could not confirm from the excerpt: whether the session logged
live damaged boundary heldjust before the seam at 09:38:59. If that line is not there, this is not the whole story for Kim's Convenience. So the full stretch around that seam would still help, from this build or the next one.A retest on Kim's Convenience would be very welcome, and Dragons' Den again to make sure it still holds. Leaving the issue open until then.
psykix commentedon Nov 7, 2026
Retested main at 90caa0a on an Apple TV 4K (tvOS 27.3), Release build.
Kim's Convenience: fixed. The seam into the ad pod at 22:47:07 logged the held packet and then forwarded it:
No no-cut stall and no retune. The pod's later seams (22:47:16, 22:47:42 with a second parameter-set change, 22:48:12) all cut cleanly, the sound stayed on throughout, and the programme came back without freezing. Dragons' Den is still fine as well.
Thank you, that's both channels working.
superuser404notfound commentedon Nov 8, 2026
Released in 7.60.0: round 2 (
c9ff2148, per-packet stride across a multi-frame PES) and round 3 (90caa0af, the damaged-boundary seam), the build retested above.psykix commentedon Nov 8, 2026
Confirmed on 7.60.0 (Lumen now ships it). Closing, thanks again.