Identify a frame clip by provenance, not by inferring it from timestamps
Four audit rounds each fixed one rule in SeamPlan::place and broke another, because the question the rules were answering has no answer. Inside a seamless-branching overlap clip k OUT comes AFTER clip k+1 IN — 57.8s of overlap on the real fixture table — so a single timestamp is legitimately inside two clips, and a clip file is not trimmed to its marks, so it also carries material from before its own IN. No rule over timestamps can say which clip a frame came from, and each attempt was right for one disc layout and silently wrong for another: 65s of rewind, 17 minutes stranded, 28 minutes dropped, 55s refused. Frames already carry the byte offset they were read from (PesFrame::source, stamped by the TS demuxer). Clip now carries the byte span its stream occupies in the title feed, recorded while the extents are gathered. So the clip is a LOOKUP: the offset falls in exactly one span. There is no decision to get wrong. Every track of a clip lives in the same stream file and therefore shares one span, so video, audio and subtitles agree by construction. Divergence between them — each track guessing separately under its own tolerance — is how audio and video ended up on different clips and drifted apart in the first place. spans_trusted gates the whole path: unless the spans tile the feed contiguously from zero, an offset means nothing and provenance is ignored in favour of the mark heuristics, which is the 1.6.0 behaviour. A broken map degrades instead of confidently selecting a wrong clip for every frame. A clip referenced twice reuses its first span (the bytes are read once) and is still trusted. Sources that stamp no provenance — a mkv:// remux, the deserialize hop — take the heuristics, which is what they have always used and where they have always been right, because they have no overlapping clips to be ambiguous about. 36 timeline tests, six of them new and covering: the overlap case marks cannot see, all tracks agreeing, out-of-marks material dropped AND counted, a holed span map, a discontiguous one, a repeated clip, and no provenance at all.
This commit is contained in:
@@ -497,6 +497,7 @@ fn compose_xpl_titles(
|
||||
extents.extend_from_slice(exts);
|
||||
size_bytes += *size;
|
||||
parts.push(Clip {
|
||||
feed_span: None,
|
||||
clip_id: orig
|
||||
.rsplit_once('.')
|
||||
.map(|(b, _)| b)
|
||||
@@ -639,6 +640,7 @@ impl Disc {
|
||||
extents.extend_from_slice(exts);
|
||||
size_bytes += *size;
|
||||
parts.push(Clip {
|
||||
feed_span: None,
|
||||
clip_id: orig
|
||||
.rsplit_once('.')
|
||||
.map(|(b, _)| b)
|
||||
@@ -690,6 +692,7 @@ impl Disc {
|
||||
duration_secs: 0.0,
|
||||
size_bytes: *size,
|
||||
clips: vec![Clip {
|
||||
feed_span: None,
|
||||
clip_id,
|
||||
in_time: 0,
|
||||
out_time: 0,
|
||||
|
||||
Reference in New Issue
Block a user