Head start: tuning in to a warm channel pauses its releases for up to 16 s, and a false "stalling" swap follows #125

Closed
opened 2026-11-08 17:22:48 -05:00 by cmoriarty · 1 comment
Owner

A bug from #117 (PR #119). It hits nearly every tune of a background channel, which is how Emby viewers normally watch.

What happens

On 2026-11-08 the owner tuned in to 49ers vs. Raiders at 22:19:25 in Emby for Android, playing direct. The channel had been warm since 21:54:19 on edgestream3.pro (via tvsportslive.fr), holding its 15 s head start.

Time (Z) Event
22:19:25 The viewer tunes in; the hold ends
22:19:51 The stream on tvsportslive.fr is left: stalling, "the player got 0.82× real time"
22:19:55 Degrading swap to the standby on powerstream.club (hls.lshls.st, the slow CDN); the clock splices

The owner saw a micro skip. The stream itself was fine. The pause in releases was the app's own:

  1. During the hold (Timeline.release(hold=True)), only segments over the depth are released.
    • Each such release goes through Timeline._release, which sets due = min(max(due, now) + length, now + depth × length).
    • When the source lists in bursts, every extra segment pushes due one segment further ahead. Nothing pulls it back during the hold, because the clock's own releases are switched off.
    • After half an hour, due can sit up to depth × length in the future: 16 s for 8 segments of 2 s.
  2. When the hold ends, release() keeps that future due (self.due = max(self.due, now)). No new segment reaches the viewer until it arrives, while the player runs on what it was given at the tune.
  3. The served rate counts from the viewer's arrival (_served_from). Once it has 30 s, it reads the pause as the stream delivering 0.82× real time. _judge calls it stalling, and the channel swaps away from a good stream, here onto a slower CDN.

The idea

  1. When a hold ends, the clock restarts from that moment: self.due = now. The oldest held segment goes out at once, and one follows each segment length after that.
  2. Optionally, keep due from drifting during the hold: an over-depth release while holding sets due to one segment ahead of now, not ahead of the old due.
  3. Check whether _judge's slack should also count from _served_from rather than the landing. It uses now - landed, while the served rate it pairs with counts from the end of the hold.

Done when

  • In the unit lane:
    • a warm channel holds through a burst of over-depth releases, so its due has drifted ahead;
    • a viewer polls: a held segment is released at once, and one per segment length after that;
    • the served rate 30–60 s later is about 1.0×, and the health is not stalling;
    • a hold with no bursts behaves as it does today.
  • Live: a tune in to a warm channel shows no "stalling" swap in its first minute. The card's runs keep the tuned stream.
A bug from #117 (PR #119). It hits nearly every tune of a background channel, which is how Emby viewers normally watch. ## What happens On 2026-11-08 the owner tuned in to 49ers vs. Raiders at 22:19:25 in Emby for Android, playing direct. The channel had been warm since 21:54:19 on edgestream3.pro (via tvsportslive.fr), holding its 15 s head start. | Time (Z) | Event | |---|---| | 22:19:25 | The viewer tunes in; the hold ends | | 22:19:51 | The stream on tvsportslive.fr is left: `stalling`, "the player got 0.82× real time" | | 22:19:55 | Degrading swap to the standby on powerstream.club (hls.lshls.st, the slow CDN); the clock splices | The owner saw a micro skip. The stream itself was fine. The pause in releases was the app's own: 1. **During the hold** (`Timeline.release(hold=True)`), only segments over the depth are released. - Each such release goes through `Timeline._release`, which sets `due = min(max(due, now) + length, now + depth × length)`. - When the source lists in bursts, every extra segment pushes `due` one segment further ahead. Nothing pulls it back during the hold, because the clock's own releases are switched off. - After half an hour, `due` can sit up to `depth × length` in the future: 16 s for 8 segments of 2 s. 2. **When the hold ends,** `release()` keeps that future `due` (`self.due = max(self.due, now)`). No new segment reaches the viewer until it arrives, while the player runs on what it was given at the tune. 3. **The served rate** counts from the viewer's arrival (`_served_from`). Once it has 30 s, it reads the pause as the stream delivering 0.82× real time. `_judge` calls it stalling, and the channel swaps away from a good stream, here onto a slower CDN. ## The idea 1. **When a hold ends, the clock restarts from that moment:** `self.due = now`. The oldest held segment goes out at once, and one follows each segment length after that. 2. **Optionally, keep `due` from drifting during the hold:** an over-depth release while holding sets `due` to one segment ahead of now, not ahead of the old `due`. 3. Check whether `_judge`'s slack should also count from `_served_from` rather than the landing. It uses `now - landed`, while the served rate it pairs with counts from the end of the hold. ## Done when - **In the unit lane:** - a warm channel holds through a burst of over-depth releases, so its `due` has drifted ahead; - a viewer polls: a held segment is released at once, and one per segment length after that; - the served rate 30–60 s later is about 1.0×, and the health is not stalling; - a hold with no bursts behaves as it does today. - **Live:** a tune in to a warm channel shows no "stalling" swap in its first minute. The card's runs keep the tuned stream.
Author
Owner

Closing: merged to develop in PR #126 (merge b7370d0), milestone 41. It deploys once nobody is watching.

What changed:

  • Nothing comes due while a warm channel holds.
  • The clock starts again from the tune: a held segment goes out at once, then one per segment length.
  • The stall check's slack counts from the end of the hold.

Tests: a bursty hold, then a 0.8× source after the tune. On the old code they fail with "stalling 30 s after the tune".

Not seen live yet: a tune of a warm channel with no swap in its first minute.

Closing: merged to develop in PR #126 (merge b7370d0), milestone 41. It deploys once nobody is watching. **What changed:** - Nothing comes due while a warm channel holds. - The clock starts again from the tune: a held segment goes out at once, then one per segment length. - The stall check's slack counts from the end of the hold. **Tests:** a bursty hold, then a 0.8× source after the tune. On the old code they fail with "stalling 30 s after the tune". **Not seen live yet:** a tune of a warm channel with no swap in its first minute.
Sign in to join this conversation.
No labels
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#125
No description provided.