Skip to content

player: the pump owns a seek made while paused, on every seek route - #722

Merged
GLinnik21 merged 5 commits into
mainfrom
fix/paused-seek-owned-by-pump
Oct 15, 2026
Merged

GLinnik21 merged 5 commits into
mainfrom
fix/paused-seek-owned-by-pump

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Follow-up to #713 (#568, already closed by it). This is a structural fix with no open issue behind it: the media layer now owns a seek made while the viewer is paused, on every seek route. It no longer depends on each app-side caller opening the paused-seek window itself.

Why

While investigating #568 we found that an in-place seek could be armed while the viewer was paused, in a state where it could never land. The pump's feed gate (TX.feed_allowed()) stays shut under a viewer Pause unless a caller has opened the seek preroll, and only app::playback::commit_seek and the foreground restore did. Any bare request_seek made while paused (the dev autoseek trigger is one) fed nothing, tripped the stuck watchdog and then reloaded into the same shut gate. Real users' scrubs went through commit_seek, so they were not affected. Still, the media layer should not have depended on that.

What changes

  • Ownership moves to the transport. The pump now owns a paused seek: Transport::seek_preroll_owned, next to seek_preroll in shared.rs. Because it sits outside the per-session Engine, it survives reload_at, the watchdog's reload and a refused native Seek.
  • The window opens on every route. The pump opens it (own_seek_under_pause) for whichever route it dispatches while the viewer is paused:
    • an in-place seek (Segment on webOS 4.x, the public Seek on webOS 5+);
    • Reload mode (old-ABI webOS 3.x);
    • the Pause-refused, stale-Pause and retired-epoch reload fallbacks;
    • a transcode seek's landing reload.
  • It closes on the landing. settle_paused_seek re-pauses once the live engine has presented the new frame. If the re-pause fails it keeps ownership and retries on the next tick.
  • Pause pressed mid-seek. If the viewer pauses after a playing seek was dispatched but before it landed, the pump also takes ownership; hand_hold_to_seek_prime lets the prime Play through the viewer's clock hold.
  • app::playback::commit_seek is now a bare request_seek. repause_at / resume_pend and the app-side begin_paused_seek are gone from the scrub path. The foreground-restore ritual keeps its own handling.
  • The stuck watchdog does not count time while the feed gate is shut.
  • Diagnostics in ff.rs: ff: open ms=, ff: seek begin, ff: seek … ms= and ff: seek_cb reopen off= ok= ms=. They separate a slow server from a shut gate.
  • Docs: player/CLAUDE.md, the commit_scrub doc, the HUD test doc and the lifecycle.rs doc are updated to match.

Tests (each failed on the earlier commit first)

native_seek_pump_tests (hostsim) adds:

  • a paused scrub in Reload mode: the window stays open across the reload and the scrub ends paused;
  • two paused Reload-mode seeks in a row;
  • a paused transcode landing that reloads with the window open, and a guard for the case where the claim hold owns the pause;
  • a paused native Seek that is refused, falls back to a reload and ends paused;
  • a refused re-pause that is retried until it succeeds;
  • Pause pressed while a playing seek is in flight;
  • a bare paused request_seek that the dispatcher owns rather than the mid-seek branch;
  • ownership that ends with the playback.

Verification

  • make check passed; --no-default-features and the ARM build are clean. Hostsim plx_media lib: test result: ok. 1597 passed; 0 failed; 19 ignored.
  • TV (webOS 4.5, pipeline harness, synthetic fixture, no Plex account), at 539e4b5. Paused seek to 100 s and then 60 s:
    • Forced webOS 5+ public-Seek mode: Seek(100000) -> 1, then paused frame restored; pos holds at 99 s and 59 s, and it climbs only after Resume.
    • Reload mode, run twice: reload_at: fresh Load at 100s/60s, then paused frame restored; the position holds until Resume.
    • Playing control in the forced webOS 5+ mode: four Seek(...) -> 1 landings, and the position climbs to 246 s.
    • No in-place stuck, no watchdog reload and no DOWNGRADE in any run.
    • Every ff: seek took 9–84 ms.
  • Not determined: one reload's request reached the fixture server 6.8 s late (ff: open ms=6615). That seek still landed and stayed paused.
  • Not verified on a webOS 5+ set. The native path there is still pending the Seeking reloads the media #568 reporter's nightly test.

🤖 Generated with Claude Code

GLinnik21 and others added 5 commits October 15, 2026 03:08
…tchdog ignores a shut feed gate

A bare request_seek while TX.paused armed a seek whose keyframe could never be fed (feed_allowed
needs the paused-seek preroll), so the watchdog retried and reloaded into the same shut gate. The
pump now opens the preroll at the arm and closes it on the landing; commit_seek collapses to a bare
seek, and the watchdog re-bases while the gate is shut.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…load, transcode landing, refused re-pause, Pause mid-seek)

Red on 0855801: the preroll is opened only at the in-place arm and owned by the Engine.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… every seek route and closed on the landing of whichever Engine is live

Ownership moves off Engine into Transport (survives reload_at / the stuck watchdog's reload / a refused
native Seek). The pump opens the preroll for the in-place arm, Reload mode, every reload fallback and a
transcode flight's landing under a viewer Pause, and for a Pause pressed mid-seek (handing the clock hold
back to the seek prime). settle_paused_seek re-pauses on the landing and retries a refused re-pause;
only finish_seek_preroll clears the ownership. Doc comments and the player guide follow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ed and in flight; two consecutive paused Reload seeks pinned

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e doc names settle_paused_seek

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant