Skip to content

6.4.2 - VOD segment plan on the source's declared boundaries

Choose a tag to compare

@superuser404notfound superuser404notfound released this 02 Aug 03:17

A seekable HEVC-in-MPEG-TS HLS VOD no longer strands seeks on plan boundaries that no keyframe sits on.

Fixed

  • The segment plan is built on the boundaries a segmented source declares. MPEG-TS carries no upfront keyframe table, so the plan fell back to a synthetic uniform 4 s grid. On a source that carries one I-frame per 10 s segment, only every fifth grid boundary is a random-access point.

    A restart at any other index made the producer's scan-forward gate take the first IRAP at-or-after its target, up to 8 s late. That overshoot then rode in the producer's timeline shift, where the video cutter and the audio index mapping folded it back on two different axes and disagreed by exactly that amount, and AVPlayer was left waiting on a segment that never arrived at the position it asked for (CoreMediaErrorDomain -12889). A seek that happened to land on an aligned index worked, which is why one seek in five looked healthy.

    A source that declares its own boundaries now plans on them, so every advertised boundary is one the gate can open. Each is backed off half a segment (0.5 s cap) so manifest-versus-PTS rounding cannot put a boundary past its own IRAP, and the ingest reader's restart index snaps with the same tolerance rather than refetching one segment more. Measured over five scattered seeks on a 20 min 10 s-GOP fixture, the per-restart gate overshoot goes from 0/4/0/2/6 s to a flat 0.5 s.

    Reported and device-tested by @qoli (#268).

  • The VOD segment cutter compares on the item axis. Packets reach it with the producer's shift already subtracted, while the plan boundaries are source PTS. Every cut therefore landed one PTS origin late on any source that does not start at zero, and against boundaries that are themselves the source's IRAPs it would never have cut at all. The audio index mapping folds back the plan anchor rather than the shift for the same reason, so a restart's own gate overshoot can no longer route audio into a segment the video cutter never opened, and a restart's first tfdt is the segment's advertised item-axis start rather than its seek boundary (#268).

Upgrading

.package(url: "https://github.com/superuser404notfound/AetherEngine", from: "6.4.2")

Source-compatible, no public API change. Hosts see it as more accurate VOD seeks: a segment now carries the content its playlist position advertises, where before a source with a non-zero PTS origin was cut one origin late. Sources whose keyframe index is trustworthy (MP4 stss, Matroska Cues) are unaffected, their plan boundaries were already IRAPs.