A burst no longer stops the buffer's clock, and the card counts long waits #160

Merged
cmoriarty merged 1 commit from fix/buffer-clock-after-burst into main 2026-11-11 22:44:02 -05:00
Owner

Why

Raptors vs. Celtics on 2026-11-12 (givemestreams.cfd, the Shield through Emby's direct stream) froze or skipped briefly now and then while the Admin card said Healthy and Steady.

Measured 02:25–02:36Z:

  • The served video was whole: every segment had all its frames, 33 ms steps, no timestamp jumps, no filler.
  • The served playlist waited 8–10 s for its next segment every 30–60 s, then caught up.
  • The buffer held 6 of 6 segments the whole time, and each release came within a second of a new upstream segment.
  • Emby reads at the newest segment, so its log shows the same waits: 26 of 7–12 s in 28 minutes.

Cause

Timeline._release added a segment length to the next due time for every release, including one made only because the buffer was over its depth. Nothing took that back. After the first burst the clock was due further ahead for good (up to the buffer's depth), so it never fired, and every release waited for the source's next segment: one in, one out. A full buffer smoothed nothing.

Nothing counted it either: a release is only marked late when the clock makes it, the no-new-segment rule starts at 16 s, and the served rate averages a wait and its burst back to real time.

What changes

  • An over-depth release leaves the clock where it was. On the listing pattern recorded that night, the longest wait in the playlist falls from 10 s to under 5 s (test test_a_bursty_source_is_released_evenly, which fails on the old code with 10.0 s).
  • The channel counts the playlist's long waits (more than 1.5 target durations without a new segment) for ten minutes, with the longest, in served.long_waits and served.longest_wait.
  • Admin card: a stream the app counts as healthy with three long waits reads Uneven. The health's info gives the count and the longest wait, and the verdict is Your call, because the app swaps nothing for it. This is display only: the swap rules are untouched.
  • Specs: two scenarios in stream-supervision, one in admin-page.

Things to know

  • The buffer will now sit below its depth after a gap and refill on the burst, instead of staying pinned at its depth.
  • A source that really runs dry now reaches the existing late count (Running late), which can swap to a standby. Before, the stuck clock hid that too.

Testing

make test: 1261 passed, 1 skipped. Frontend: 265 passed, build clean. Not yet checked against a live game; the check after deploy is to sample a playing channel's playlist beside /api/channels and see the waits gone.

🤖 Generated with Claude Code

## Why Raptors vs. Celtics on 2026-11-12 (givemestreams.cfd, the Shield through Emby's direct stream) froze or skipped briefly now and then while the Admin card said Healthy and Steady. Measured 02:25–02:36Z: - The served video was whole: every segment had all its frames, 33 ms steps, no timestamp jumps, no filler. - The served playlist waited 8–10 s for its next segment every 30–60 s, then caught up. - The buffer held 6 of 6 segments the whole time, and each release came within a second of a new upstream segment. - Emby reads at the newest segment, so its log shows the same waits: 26 of 7–12 s in 28 minutes. ## Cause `Timeline._release` added a segment length to the next due time for every release, including one made only because the buffer was over its depth. Nothing took that back. After the first burst the clock was due further ahead for good (up to the buffer's depth), so it never fired, and every release waited for the source's next segment: one in, one out. A full buffer smoothed nothing. Nothing counted it either: a release is only marked late when the clock makes it, the no-new-segment rule starts at 16 s, and the served rate averages a wait and its burst back to real time. ## What changes - An over-depth release leaves the clock where it was. On the listing pattern recorded that night, the longest wait in the playlist falls from 10 s to under 5 s (test `test_a_bursty_source_is_released_evenly`, which fails on the old code with 10.0 s). - The channel counts the playlist's long waits (more than 1.5 target durations without a new segment) for ten minutes, with the longest, in `served.long_waits` and `served.longest_wait`. - Admin card: a stream the app counts as healthy with three long waits reads **Uneven**. The health's info gives the count and the longest wait, and the verdict is Your call, because the app swaps nothing for it. This is display only: the swap rules are untouched. - Specs: two scenarios in `stream-supervision`, one in `admin-page`. ## Things to know - The buffer will now sit below its depth after a gap and refill on the burst, instead of staying pinned at its depth. - A source that really runs dry now reaches the existing late count (Running late), which can swap to a standby. Before, the stuck clock hid that too. ## Testing `make test`: 1261 passed, 1 skipped. Frontend: 265 passed, build clean. Not yet checked against a live game; the check after deploy is to sample a playing channel's playlist beside `/api/channels` and see the waits gone. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Raptors vs. Celtics, 2026-11-12: brief freezes on the Shield while the
card said Healthy. The served video was whole, but the playlist waited
8 to 10 s for its next segment about once a minute, with six segments
held the whole time.

A release made because the buffer was over its depth added its length
to the next due time like any other, and nothing took that back. After
a burst the clock was due further ahead for good, so it never fired and
every release waited for the source's next segment, one in, one out.
An over-depth release now leaves the clock where it was. On the listing
pattern recorded that night the longest wait falls from 10 s to under
5 s.

The channel also counts the playlist's long waits (over one and a half
target durations) for ten minutes. A stream the app counts as healthy
with three of them reads Uneven on the Admin card, with the count and
the longest in the health's info, and the verdict is Your call: the app
swaps nothing for it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
cmoriarty deleted branch fix/buffer-clock-after-burst 2026-11-11 22:44:02 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/sports-breaker!160
No description provided.