A source's segment gaps reach Emby unbuffered and freeze the player while the channel says Healthy #53

Closed
opened 2026-10-29 21:32:38 -04:00 by cmoriarty · 1 comment
Owner

What happened (2026-10-29, Packers vs. Panthers, Emby on the Shield)

The picture froze about three minutes after tuning and didn't recover. Sports Breaker said Healthy throughout and never showed the filler card. Times are local (UTC−4).

  • 21:15:30: tuned. Emby direct-streamed the channel (ffmpeg-directstream-f2d23101…).
  • From about 21:17: the source (sportsurge → iohit.st, CDN s1.toocdn.top:8443, 720p60, 6 s segments) delivered unevenly. Gaps of 10–13 s were followed by two segments at once. Emby fetched segments 30, 31 and 32 at 21:18:21, 21:18:40 and 21:18:40: 19 s without a new segment.
  • 21:18:38: the Android TV app (3.5.55, Media3) gave up and asked again. Emby killed the direct stream and started a VAAPI→QSV transcode (ffmpeg-transcode-bead11fe…). The transcode ran cleanly at about 1.05–1.2× from then on, but the player stayed frozen until it was re-tuned.

Why Sports Breaker passed it on

  • The channel's playlist has no buffer. Sampled once a second for 70 s, the playlist gained each segment the moment it arrived from the source ("seconds since new segment" reset to 0 at the same instant). The source's gaps and bursts reach Emby exactly as they arrive.
  • The health check stays Healthy through these gaps.
    • classify marks FAILED only after 2× the target duration (12 s) with nothing new.
    • segment_in also resets that clock whenever a fetch-ahead's bytes land.
    • So a slow download that is still trickling in keeps the channel Healthy, while the playlist can't list the segment until it finishes. No filler, no swap.
  • Emby's live player holds only a few seconds behind the edge, so a gap of more than about 10 s empties it.

Proposed fix: a jitter buffer on the channel

  • Hold the served playlist one or two segments behind what the channel has, and release segments on the wall clock: one target duration apart, not when they arrive. Bursts and gaps up to the buffer's depth never reach the player. The cost is 6–12 s more latency, which doesn't matter for this use.
  • When the buffer runs dry, splice the filler card at once instead of waiting for FAILED. This also covers #50's "filler starts too late".
  • Show the buffer's depth on the Admin card, and count a channel whose buffer keeps running low as degrading, even when every segment eventually arrives.
  • Check the effect on cold tunes: the buffer should fill from the backlog without delaying the first frame more than it does now.

Done when

  • A recorded or simulated source with 12–19 s gaps and two-segment bursts plays in Emby on the Shield without freezing.
  • The served playlist advances one segment per target duration, give or take 1 s.

Related: #50 (filler too late; the card's SPS breaks the hardware transcode), #40 (health misses frame drops).

## What happened (2026-10-29, Packers vs. Panthers, Emby on the Shield) The picture froze about three minutes after tuning and didn't recover. Sports Breaker said Healthy throughout and never showed the filler card. Times are local (UTC−4). - **21:15:30:** tuned. Emby direct-streamed the channel (`ffmpeg-directstream-f2d23101…`). - **From about 21:17:** the source (sportsurge → iohit.st, CDN `s1.toocdn.top:8443`, 720p60, 6 s segments) delivered unevenly. Gaps of 10–13 s were followed by two segments at once. Emby fetched segments 30, 31 and 32 at 21:18:21, 21:18:40 and 21:18:40: **19 s without a new segment.** - **21:18:38:** the Android TV app (3.5.55, Media3) gave up and asked again. Emby killed the direct stream and started a VAAPI→QSV transcode (`ffmpeg-transcode-bead11fe…`). The transcode ran cleanly at about 1.05–1.2× from then on, but the player stayed frozen until it was re-tuned. ## Why Sports Breaker passed it on - **The channel's playlist has no buffer.** Sampled once a second for 70 s, the playlist gained each segment the moment it arrived from the source ("seconds since new segment" reset to 0 at the same instant). The source's gaps and bursts reach Emby exactly as they arrive. - **The health check stays Healthy through these gaps.** - `classify` marks FAILED only after 2× the target duration (12 s) with nothing new. - `segment_in` also resets that clock whenever a fetch-ahead's bytes land. - So a slow download that is still trickling in keeps the channel Healthy, while the playlist can't list the segment until it finishes. No filler, no swap. - **Emby's live player holds only a few seconds behind the edge**, so a gap of more than about 10 s empties it. ## Proposed fix: a jitter buffer on the channel - **Hold the served playlist one or two segments behind** what the channel has, and release segments on the wall clock: one target duration apart, not when they arrive. Bursts and gaps up to the buffer's depth never reach the player. The cost is 6–12 s more latency, which doesn't matter for this use. - **When the buffer runs dry, splice the filler card at once** instead of waiting for FAILED. This also covers #50's "filler starts too late". - **Show the buffer's depth on the Admin card**, and count a channel whose buffer keeps running low as degrading, even when every segment eventually arrives. - **Check the effect on cold tunes:** the buffer should fill from the backlog without delaying the first frame more than it does now. ## Done when - A recorded or simulated source with 12–19 s gaps and two-segment bursts plays in Emby on the Shield without freezing. - The served playlist advances one segment per target duration, give or take 1 s. Related: #50 (filler too late; the card's SPS breaks the hardware transcode), #40 (health misses frame drops).
Author
Owner

Deployed 2026-10-29 22:56 local (PR #54, develop d8a7264).

Checked live on the source that froze, Packers vs. Panthers on iohit.st, by sampling the channel once a second for 90 s:

  • The source still arrived unevenly: gaps between new segments of 1.6 to 11.4 s.
  • The channel held its 12 s buffer (two segments) at every sample.
  • Health stayed Healthy, with no late releases and no filler.

Still open: seeing Emby on the Shield play through a real stall.

**Deployed 2026-10-29 22:56 local** (PR #54, develop d8a7264). Checked live on the source that froze, Packers vs. Panthers on iohit.st, by sampling the channel once a second for 90 s: - The source still arrived unevenly: gaps between new segments of 1.6 to 11.4 s. - The channel held its 12 s buffer (two segments) at every sample. - Health stayed Healthy, with no late releases and no filler. **Still open:** seeing Emby on the Shield play through a real stall.
Sign in to join this conversation.
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#53
No description provided.