Skip to content

Live HLS ingest: clock restart at an ad break is treated as source replay (sound lost, or looping) #996

Closed

Description

@psykix

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:

  1. 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.

  1. 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.

  2. 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

  1. Load an ad-stitched live HLS channel with isLive = true, nativeRemoteHLS = false, dvrWindowSeconds = 1800.
  2. 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.
  3. 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

  1. added
    bug
    on Nov 6, 2026
  2. quint-aether commented on Nov 6, 2026

    @quint-aether

    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 / sourceReplay path 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:

    • Dragons' Den: the full engine log from the second reopen (when the programme returns) through the first few sound=none segments.
    • Kim's Convenience: the full log of the six reopens, including any line about the reopen budget or liveSourceReset around 12:10:53.

    Automated triage by Quint (Claude). A maintainer reads every issue and will follow up.

  3. psykix commented on Nov 6, 2026

    @psykix
    Author

    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=none segment. The [LiveTV] no sound for 8 segments line is that filter counting them, and it counts only segments marked sound=none. The [LiveTV] sound back after 15 segments line 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 said outputEnd=111.2s. No audio timeline rebase appears anywhere in this stretch. Kim's Convenience also opens with pinnedTo ... shift=0 on 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 says succeeded on attempt 1. The same pattern repeats through 12:10:53, then it plays on. liveSourceReset only 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)
    11:01:17 [HLSIngest] discontinuity seam before segment https://d2j6wrf7a3rz4k.cloudfront.net/<trimmed>
    11:01:17 [ReplayVideoBoundary] route=native damaged=0 replaced=0 unreplaced=0 retained=1558 keyframes=27 superseded=0 untimed=0
    11:01:17 [HLSSegmentProducer] live source overlap resolved: removed 223 video + 334 audio packets across 7.41s; first new packet continues the existing timeline
    11:01:17 [HLSSegmentProducer] first source read after start took 42180ms
    11:01:17 [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:17 [HLSSegmentProducer] video gate open: actual=1741926440 anchorPts=1741932446 target=-9223372036854775808 desired=9870816 shift=1732055624 presentedShift=1732061630 lead=6006 videoPID=0 reconstructed=false
    11:01:17 [HLSSegmentProducer] audio dts non-monotonic at source: orig=1737738146 lastValid=1737738146 → bumped to 1737738147
    11:01:17 [VideoPacketProgress] event=gap route=native previous=19356.673 dts=95445.718 gap=76089.044 cadence=0.033
    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 [HLSSegmentProducer] pump finished: reason=sourceReplay packetsRead=172 packetsWritten=59 lastError=0 elapsed=42191ms cacheCount=112
    11:01:17 [HLSVideoEngine] live source repeated previously accepted media; reopening source while retaining cache and replay history
    11:01:17 [HLSVideoEngine] live pump exited (reason=sourceReplay); starting reopen
    11:01:19 [HLSIngest] joined 8 segment(s), ~20s behind the live edge pdt=nil
    11:01:20 [AetherEngine] #446 the window ran out and the source is delivering again; swapping the item so the session is live once more, at 19308.26s, the place it held
    11:01:20 [AetherEngine] #65 nudge did not revive the consumer; reloading item at 19308.26s, the place it held (carried across the swap: the window it played out under was closed, so its own distance behind live reads zero) (same URL, same host)
    11:01:20 [AetherEngine] #454 placing the fresh item at 19308.26s in its own playlist: segment 109 + 0.43s (output 109.61s), so it never joins the edge to be corrected off it
    11:01:20 [AetherEngine] #684 item #2 starts at its own 90.090s: segment 90 + 0.000s, whose picture opens at 90.157s and whose sound was not recorded
    11:01:20 [AetherEngine] #454 the fresh item came up at its own 90.09s of 0.00..89.61s, 19.45s from the 109.54s the rejoin asked for; the placement seek follows
    11:01:20 [AetherEngine] #446 rejoin to 19308.26s; the producer holds 19198.72..19309.89s and the item reports 19198.72..19288.32s, landing at 19308.26s, the place it held
    11:01:20 [AetherEngine] live seek target=19308.25945796089 clockTarget=109.5437690719989 seekableEnd=89.609 sessionShift=19198.648955555556 sourceShift=19198.648955555556 publishedEdge=19286.82368888889
    11:01:20 [Demuxer] Opened: 2 streams, duration=-9223372036854775808 us
    11:01:20 [HLSSegmentProducer] init OK (baseIndex=112, segments=0, targetDur=0.500s, srcVideoTb=1/90000) audio=stream-copy inTb=1/90000
    11:01:20 [HLSSegmentProducer] live source replay history continued: entries=59
    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 [NativeAVPlayerHost] #2 item.audioTrack codec='aac ' enabled=true sr=48000 ch=2 bits=0 fmt=aac  layoutTag=<missing> (readyToPlay)
    11:01:20 [HLSIngest] discontinuity seam before segment https://d2j6wrf7a3rz4k.cloudfront.net/<trimmed>
    11:01:20 [VideoPacketProgress] event=gap route=native previous=51.983 dts=19354.738 gap=19302.755 cadence=0.033
    11:01:20 [HLSSegmentProducer] video timeline rebase (live): jumpTicks=1737247946 srcDts=1741926440 lastSrcDts=4678494 oldShift=0 newShift=1737244943 continuationDts=4681497
    11:01:20 [HLSSegmentProducer] same-PID in-band parameter-set change #1 on video PID stream=0 (1920x1080, 54->53 B SPS/PPS); forcing a discontinuity cut + versioned init so the new avcC matches the slices
    11:01:20 [HLSSegmentProducer] muxer rotation (same-PID parameter-set change): seg-118 finalized on old init, fresh versioned init for seg-119 (1920x1080)
    11:01:24 [NativeAVPlayerHost] seek completion target=109.54 actual=110.61 finished=true landed=false current=true
    11:01:24 [AetherEngine] seek#2 programmatic landed rendered=19308.26 target=19308.26
    11:01:24 [LiveTV] no sound for 8 segments: [HLSSegmentProducer] live seg-126 finalized: start=59.090s dur=1.001s sound=none
    11:01:28 [HLSIngest] discontinuity seam before segment https://d2j6wrf7a3rz4k.cloudfront.net/<trimmed>
    11:01:28 [HLSSegmentProducer] same-PID in-band parameter-set change #2 on video PID stream=0 (1920x1080, 53->53 B SPS/PPS); forcing a discontinuity cut + versioned init so the new avcC matches the slices
    11:01:28 [LiveTV] sound back after 15 segments: [HLSSegmentProducer] live seg-134 finalized: start=66.734s dur=0.500s
    
    Kim's Convenience, first two rounds of reopens (long lines shortened)
    12:10:44 [HLSIngest] discontinuity seam before segment https://d3rciv7av2te5a.cloudfront.net/<trimmed>
    12:10:44 [HLSSegmentProducer] SSAI video program switch: videoStreamIndex 0 → 2 (ad/program 1280x720 on a new video PID)
    12:10:44 [HLSSegmentProducer] video timeline rebase (live): jumpTicks=-7128390000 srcDts=180000 lastSrcDts=7128570000 oldShift=7116863101 newShift=-11530652 continuationDts=11710652
    12:10:44 [HLSSegmentProducer] muxer rotation (SSAI program switch): seg-77 finalized on old init, fresh versioned init for seg-78 (1280x720)
    12:10:44 [HLSSegmentProducer] live source AXIS RESET detected on audio: srcDts=8590114592 (wrap-corrected raw=180000) firstSeenDts=68708190 jumpTicks=+1461531392; source renumbered its 33-bit clock from zero and is re-sending content already played
    12:10:44 [HLSSegmentProducer] pump finished: reason=sourceReplay packetsRead=9293 packetsWritten=3191 lastError=0 elapsed=111363ms cacheCount=79
    12:10:44 [HLSVideoEngine] live source repeated previously accepted media; reopening source while retaining cache and replay history
    12:10:44 [HLSVideoEngine] live pump exited (reason=sourceReplay); starting reopen
    12:10:45 [HLSIngest] joined 6 segment(s), ~22s behind the live edge pdt=nil
    12:10:46 [HLSSegmentProducer] init OK (baseIndex=79, segments=0, targetDur=0.500s, srcVideoTb=1/90000) audio=stream-copy inTb=1/90000
    12:10:46 [HLSVideoEngine] live reopen succeeded on attempt 1: continuing at seg79 (outputEnd=130.7s)
    12:10:46 [HLSSegmentProducer] video gate open: actual=78966000 anchorPts=78973470 target=-9223372036854775808 desired=11758651 shift=67207349 presentedShift=67214819 lead=7470 videoPID=0 reconstructed=false
    12:10:46 [HLSSegmentProducer] audio gate open: actual=78966750 target=78966000 desired=11758651 shift=67207349 gapMs=0.0
    12:10:46 [HLSIngest] discontinuity seam before segment https://live-content-cf.xumo.com/<trimmed>
    12:10:46 [VideoPacketProgress] event=gap route=native previous=888.513 dts=79201.400 gap=78312.887 cadence=0.042
    12:10:46 [HLSSegmentProducer] video timeline rebase (live): jumpTicks=7048159864 srcDts=7128126000 lastSrcDts=79966136 oldShift=67207349 newShift=7115363460 continuationDts=12762540
    12:10:46 [HLSSegmentProducer] muxer rotation (same-PID parameter-set change): seg-84 finalized on old init, fresh versioned init for seg-85 (1280x720)
    12:10:46 [HLSSegmentProducer] audio timeline rebase (live): jumpTicks=7048164930 srcDts=7128130080 lastSrcDts=79965150 oldShift=67207349 newShift=7115367540 (video-derived)
    12:10:46 [HLSIngest] discontinuity seam before segment https://d3rciv7av2te5a.cloudfront.net/<trimmed>
    12:10:46 [HLSSegmentProducer] SSAI video program switch: videoStreamIndex 0 → 2 (ad/program 1280x720 on a new video PID)
    12:10:46 [HLSSegmentProducer] video timeline rebase (live): jumpTicks=-7128390000 srcDts=180000 lastSrcDts=7128570000 oldShift=7115363460 newShift=-13030293 continuationDts=13210293
    12:10:46 [HLSSegmentProducer] muxer rotation (SSAI program switch): seg-87 finalized on old init, fresh versioned init for seg-88 (1280x720)
    12:10:46 [HLSSegmentProducer] live source AXIS RESET detected on audio: srcDts=8590114592 (wrap-corrected raw=180000) firstSeenDts=78966750 jumpTicks=+1461531392; source renumbered its 33-bit clock from zero and is re-sending content already played
    12:10:46 [HLSSegmentProducer] pump finished: reason=sourceReplay packetsRead=1230 packetsWritten=471 lastError=0 elapsed=276ms cacheCount=89
    
  4. psykix commented on Nov 6, 2026

    @psykix
    Author

    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:

    programme (cloudfront)   0x1e1 h264, 0x1e2 aac, 0x1e3 scte_35, 0x1e4 timed_id3
    ad (MediaTailor)         0x1e1 h264, 0x101 aac
    

    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:

    11:00:35 [Demuxer] Opened: 4 streams
    11:01:20 [Demuxer] Opened: 2 streams
    

    audioConfig.sourceStreamIndex is 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:

    0,video,0x1e1
    1,audio,0x101     96 packets
    2,audio,0x1e2    282 packets
    

    The isAudioPkt check in HLSSegmentProducer compares against the bound index, so every programme audio packet falls through as a foreign packet. That would explain all of it:

    • no audio rebase is logged, because no audio packet ever reaches that code
    • segments carry sound=none while video carries on
    • sound comes back at a later ad, because the bound PID is playing again
    • AVPlayer is fine playing the same stream directly
    • most channels are unaffected, because their ads share the programme's audio PID

    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.

  5. superuser404notfound commented on Nov 6, 2026

    @superuser404notfound
    Owner

    Thank you for the logs and especially for the PID probe, which pinned down the second fault exactly. Both faults are fixed on main (merge b9dd696b, not in a release yet).

    Looping and the reopen at the break. The clock restart behind EXT-X-DISCONTINUITY reached 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 0x1e2 arrived 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 is audio follows the source to stream N. This covers stream-copy ADTS AAC, which all three channels use. A bridged track or another codec logs not followed once 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 + x value 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.

  6. psykix commented on Nov 6, 2026

    @psykix
    Author

    Thanks, I tried main at b9dd696 on an Apple TV 4K (tvOS 27.3), Dragons' Den, joining during an ad.

    The follow itself works:

    19:50:37 audio follows the source to stream 2 (was 1): bound stream silent for 2.04s, seam=true packets=1 returning=false
    19:50:37 audio timeline rebase (live): jumpTicks=4590259202 srcDts=4594939685 lastSrcDts=4680483 oldShift=1080900 newShift=4591339088 (video-derived)
    

    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:

    19:50:37 audio timeline rebase (live): jumpTicks=-430080 srcDts=4595001125 lastSrcDts=4595431205 oldShift=4591339088 newShift=4590907088 (independent)
    19:50:37 audio timeline rebase (live): jumpTicks=-430080 srcDts=4595031845 lastSrcDts=4595461925 oldShift=4590907088 newShift=4590475088 (independent)
    

    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:

    19:50:44 live seg-30 finalized: start=50.083s dur=1.001s sound=159.751..169.692s
    

    That's about 110 s ahead. The session had already logged this on the ad's stream, before the follow:

    19:50:10 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
    

    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.

  7. superuser404notfound commented on Nov 7, 2026

    @superuser404notfound
    Owner

    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 (merge c9ff2148, 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 -12888 reloads 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.

  8. psykix commented on Nov 7, 2026

    @psykix
    Author

    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):

    09:38:59 [HLSIngest] discontinuity seam before segment https://hls-beacons-us.xumo.com/hlsstream/v1/beacon?url=…/split_202607222237/1_056_b.t…
    09:38:59 [HLSSegmentProducer] audio timeline rebase (live): jumpTicks=-7098081090 srcDts=30502110 lastSrcDts=7128583200 oldShift=7125970080 newShift=27887070 (independent)
    09:38:59 [HLSSegmentProducer] video timeline rebase (live): jumpTicks=-7098044505 srcDts=30525495 lastSrcDts=7128570000 oldShift=7125966000 newShift=27918495 continuationDts=2607000
    09:38:59 [HLSSegmentProducer] same-PID in-band parameter-set change #2 on video PID stream=0 (1280x720, 52->51 B SPS/PPS); forcing a discontinuity cut + versioned init so the new avcC matches the slices
    09:39:01 [NativeAVPlayerHost] #1 errorLog code=-12888 (Playlist File unchanged for longer than 1.5 * target duration)
    09:39:04 [HLSSegmentProducer] no-cut stall: no segment finalized for 10s (packetsRead=2973, sinceFinalize=817, rate=75.0pkt/s, cutter wedge); window video=28 key=1 audio=66 foreign=0; aborting the source read and exiting for host retune
    09:39:04 [HLSVideoEngine] live segment cutter stalled (likely SSAI ad pod); requesting host retune to the server route
    

    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.

  9. superuser404notfound commented on Nov 7, 2026

    @superuser404notfound
    Owner

    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 (merge 90caa0af, 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 in segmentStall after 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 held just 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.

  10. psykix commented on Nov 7, 2026

    @psykix
    Author

    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:

    22:47:07 [HLSSegmentProducer] live damaged packet: stream=video action=held count=1 dts=118920870 pts=118920870 keyframe=false
    22:47:07 [HLSSegmentProducer] live damaged boundary held: sourceSeconds=1321.343; waiting for replay evidence before publishing video
    22:47:07 [HLSSegmentProducer] live damaged boundary unconfirmed: forwarding retained packets without resetting source history
    22:47:07 [HLSSegmentProducer] live damaged packet: stream=video action=forwarded count=1 dts=118920870 pts=118920870 keyframe=false
    22:47:07 [HLSSegmentProducer] video timeline rebase (live): jumpTicks=7009201350 srcDts=7128126000 lastSrcDts=118924650 oldShift=94626630 newShift=7103824227 continuationDts=24301773
    22:47:07 [HLSSegmentProducer] same-PID in-band parameter-set change #1 on video PID stream=0 (1280x720, 51->52 B SPS/PPS); forcing a discontinuity cut + versioned init so the new avcC matches the slices
    

    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.

  11. superuser404notfound commented on Nov 8, 2026

    @superuser404notfound
    Owner

    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.

  12. psykix commented on Nov 8, 2026

    @psykix
    Author

    Confirmed on 7.60.0 (Lumen now ships it). Closing, thanks again.

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

    area: audioarea: livebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions