feat(audio): align a fetched manifest to the local file before storing
The signature had a producer and a reader but no consumer, so nothing ever fingerprinted anything. `ManifestAligner` runs on the fetch path, before the windows are stored. A local alignment supersedes the server's offset. The server has never seen this file — its offset is a runtime-difference inference at best, while the local comparison is against the media the windows will actually be drawn over. It also needs no round trip, so no signature leaves the instance. This is what jRay's spec already meant by matching being a consumer concern: the server never rewrites a manifest, so one stored manifest serves every trim of the same cut. The offset has two terms and only one is in the server's pseudocode. Both windows are centred on their own file's midpoint, so unequal runtimes start them at different absolute times; a release with 40 s of extra head material recovers 20 s from the slide and 20 s from the anchor difference. Using the slide alone is wrong by half the runtime difference on every shifted release. Degradation, never failure. Signatures off, no manifest signature, media under the window, a `v2:` producer, a missing binary, a decode error — each applies the server's offset rather than refusing, because a signature is an enhancement to cut matching and must never break a fetch. "Un-comparable" and "does not match" are kept distinct, which a test caught: `Compare` returns null for both, and conflating them would report a 90-second extra as content disagreeing with its own manifest. A genuine disagreement is stored anyway — the audio may legitimately differ, a different language track being the obvious case — and surfaced as a caveat that outranks the tier's, since it is the stronger statement. The applied offset, score, slide and the local file's own signature are written beside the truth file: the offset is otherwise unrecoverable once the windows are shifted, and the stored signature lets a later fetch align without decoding again. Provenance is never injected into the truth file, so the bytes served back stay the producer's (JR-004). `docs/audio-alignment.md` documents the mechanism end to end. TRACES: JR-047 | SR-003
This commit is contained in:
@@ -816,10 +816,39 @@ offsets compare a handful of frames, where a chance agreement scores 1.0 and
|
||||
beats the true alignment. It never binds on the real case — two full-length
|
||||
signatures still overlap by 688 frames at the widest offset.
|
||||
|
||||
**Gap:** the signature is computed and can now be read, but nothing yet *calls*
|
||||
either: `ComputeAudioSignatures` still gates nothing, no fetch path attaches a
|
||||
signature or consults the matcher, and no contribution carries one. That wiring
|
||||
belongs to the fetch and contribute paths (JR-031, JR-034), not here.
|
||||
JR-047 connects it. `ManifestAligner` runs on the fetch path, before anything is
|
||||
stored: it computes the local file's signature, compares it against the one the
|
||||
manifest carries, and **applies the local offset in preference to the server's**.
|
||||
The server has never seen this file — its offset is a runtime-difference
|
||||
inference at best — and the comparison needs no round trip, so no signature
|
||||
leaves the instance. `ComputeAudioSignatures` now gates that decode.
|
||||
|
||||
Everything that can go wrong degrades to the server's offset rather than
|
||||
refusing: signatures off, no manifest signature, media under the window, a `v2:`
|
||||
producer, a missing binary, a decode error. A signature is an enhancement to cut
|
||||
matching and must never be able to break a fetch. A *genuine* disagreement —
|
||||
both signatures valid, both items long enough, best alignment still under 0.60 —
|
||||
is recorded and surfaced as a caveat that outranks the tier's own, since "the
|
||||
audio does not match" is a stronger statement than "the runtimes differ"; the
|
||||
manifest is still stored, because the audio may legitimately differ.
|
||||
|
||||
"Un-comparable" and "does not match" are kept distinct. A 90-second extra is not
|
||||
content disagreeing with its manifest, and reporting it as such would be worse
|
||||
than saying nothing.
|
||||
|
||||
The applied offset, the score, the recovered slide, and the local file's own
|
||||
signature are written beside the truth file (`TruthAlignment`) — the offset is
|
||||
otherwise unrecoverable once the windows are shifted, and the stored signature
|
||||
lets a later fetch align without decoding again.
|
||||
|
||||
See [`docs/audio-alignment.md`](docs/audio-alignment.md) for the mechanism end to
|
||||
end.
|
||||
|
||||
**Gap:** contribution does not yet attach a signature (JR-034), and the stored
|
||||
`local_signature` is written but not read back, so today every fetch decodes.
|
||||
Server-side catalogue matching — `POST /manifests/search` and the `audio` tier —
|
||||
is the server's UR-009 and is deliberately sequenced after signature coverage
|
||||
accumulates; nothing here depends on it.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user