Admin: how far each standby is from the stream playing, and how far each swap moved the picture #167
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
cmoriarty/sports-breaker#167
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
The owner, 2026-11-14: "Currently, the user experience when watching is the video will abruptly jump to another point in time, and it's annoying when it goes back in time because you have to re-watch something, and confusing when it jumps forward because you missed something."
Every change of stream starts the new one three segments from its end (
Timeline.append_upstream,SPLICE_EDGE_SEGMENTS), and nothing compares where the two streams are in the game. Measured that afternoon on four games:Two streams of one game ran 5 to 16 s apart. The app knows none of this today, and Admin cannot say how far a swap moved the picture.
This is step 1 of 3 in the milestone. It changes nothing a viewer sees.
The idea
Hear where each standby is. The watch already downloads each standby's newest segment every 45 s (
watch._sample) and throws it away. Decode its sound and find it in the sound of the stream playing, which the channel holds in memory (its buffered and lately served segments). Where it fits gives the relation between the two streams: how many seconds apart their clocks are for the same moment of the game.What the research found (notes and scripts:
/Users/cmoriarty/Library/Application Support/Claude/side-session-notes/local_daf105a8-87c5-4403-af2c-b78517c66b67/stream-swap-research.md; the owner's page: https://claude.ai/artifact/TCY5qaAe54rzrNnmjajbok):stream_identity).Three things the build has to get right:
Rules that keep it honest
The owner, 2026-11-14:
So:
How a relation behaves across a break when the two streams carry different commercials was not measured: no such pair was seen. This step logs it, and step 2 is built on what it shows.
Show it
What it costs
Data it needs
offset_seconds(positive when the link is ahead of the stream playing),offset_state(same_stream,trusted,found,stale,none) andoffset_confirmed_at.Channel._swap_fields):moved_seconds(negative when the picture went back, null when not known) andmoved_by(timestampsorsound).Done when
In the unit lane, with streams generated for the test (no broadcast sound in the repository): one programme cut into 3 s and 5 s segments at different delays, a second programme, and a pair with different commercials spliced into the same programme.
Live: on a game with two different streams the Links table shows the gap, and a Swap by hand records how far the picture moved.
Specs:
stream-supervision,admin-page,event-log.Reference from the research, not production code: the comparison as the scripts did it (
analyze.pyin the notes folder, with numpy). It is here so the method does not depend on a scratch folder.How it was used:
refis the playing stream's sound laid on its own timestamps (each segment's samples placed by its first audio timestamp),qis one segment of the standby. Both go throughpreemphfirst.(the standby segment's first audio timestamp) - (the timestamp of ref at the best place).EXT-X-PROGRAM-DATE-TIMEis the packager's own clock: within 3 s of the fetch on two streams that were 16 s apart in the game. No use here.Merged and live.
mainas0a9d8e1(the change itself isf32c5f6). The OpenSpec change was archived ina96b034, pushed two seconds after the merge so that one build and one restart carried both: the merge's own build (run 3973) was cancelled by the newer push, aspublish-image.ymlis set to do, and the build ofa96b034(run 3974) issuccess.a96b034(/api/version).Seen live in the first quarter of an hour, on Lions vs. Patriots, from the app's own API and the container's log (nothing pressed, no site read by hand):
Not seen yet:
How good the figure is: to a second or two. The relation between two streams' clocks was logged once per link and did not move, but the seconds shown also need each link's clock against the wall. That comes from the moment the watch first saw a segment listed: it reads a kept link's playlist every 1 to 3 s, samples a standby's segment every 45 s at most, and keeps ten minutes of readings. So the figure moved between reads while the relation stood still (the table's last column). #168 joins on the relation and the segments' own timestamps, not on this figure.