Skip to content

Give play back through the startup runner after a transcode seek - #1285

Merged
GLinnik21 merged 3 commits into
mainfrom
fix/transcode-seek-landing-play
Nov 8, 2026
Merged

GLinnik21 merged 3 commits into
mainfrom
fix/transcode-seek-landing-play

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

What broke

On nightly 0.10.0-nightly-20261108 (webOS 4.10.2), scrubbing during a transcode (here a Boost Dialog enhanced remux of a 4K Dolby Vision P8 film) froze the picture at the scrub target. The event log after the landing:

  • claim hold: paused at the claim offset while the server prepares the new stream
  • reload_transcode: fresh Load at offset 343s
  • player: user Resume accepted; physical Play remains fenced
  • SMP: Load returned ok=1, SMP loadCompleted, ACB bound
  • then no SMP Play. The video lane filled to 5.5 s and every Feed answered BufferFull; timeline playing t=343s repeated until BACK.

Why

Since #1274 the common startup runner owns a reloaded stream's first Play. A transcode seek's landing reloads while the claim hold's pause is still standing, so the reload's startup goal is recorded as paused (InitialPlayback { paused: true }). claim_hold::release then gave play back with a direct player::resume: the Feed answered Fenced, which committed the transport to playing, but the runner was never told. At loadCompleted Startup::next reached Stage::Play with a paused plan, finished, and never commanded Play, so try_prime returned early forever.

The fix

claim_hold::release now gives play back through the door a viewer press uses: the active attempt's backend control (PlayerAdapter::backend_transport_control), which turns the runner's startup goal to Play. The direct player::resume stays as the fallback when there is no attempt. Neither path counts as a viewer press.

Tests

  • a_playing_transcode_seek_landing_issues_play_on_the_reloaded_stream: a playing transcode, a seek flight with the claim hold up, the landing's reload through the real runner start, the host Load and loadCompleted, then frames in app/run.rs's order (pump, then the backend poll). It asserts that the sink's Play count rises, the transport opens and the clock advances. This is the shape the field reload took (an immediate start, not a primed one). It fails before the fix: the reloaded stream's first Play never reached the sink (startup_play_commanded=false, … runner's startup goal after the landing paused=Some(true) …).
  • a_playing_primed_transcode_seek_landing_issues_play_on_the_reloaded_stream: the same flow on a segmented-HLS route, which primes before Play (ResumeInitial → prime → Play). It also fails before the fix and passes after it.
  • The flight-test Rig::frame now runs the backend poll after pump, as the app loop does. a_refused_automatic_original_recovery_reopens_the_retained_hls waits, bounded, for the feed gate to open, since the reopened Engine's Load is still in flight at the landing. Its assertion is unchanged.

Gates run locally on the committed tree:

  • make test-hostsim C=plx_media T=player::: 932 passed, 0 failed
  • make test-crate C=plx_media T=player::: 672 passed, 0 failed
  • make check-nodef: clean
  • ci/check-deps.sh: green, no ledger lines

Not yet verified on the television, which is in use. The device check is a Boost Dialog remux on the mock server as Guest: scrub, then confirm SMP Play after the reload's loadCompleted.

🤖 Generated with Claude Code

GLinnik21 and others added 3 commits November 9, 2026 00:56
A scrub on a playing transcode flies with the claim hold engaged; the
landing reloads with the hold's pause as the common Start's
InitialPlayback.paused, and the hold's give-back goes through the feed
door (player::resume) instead of the BackendRunner, so the startup plan
still reads paused at Stage::Play and never dispatches the first Play.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aim hold

Field (nightly 0.10.0-nightly-20261108, Boost Dialog remux): after a scrub the reloaded
stream reached loadCompleted with both lanes full and never got a native Play, so the clock
froze. Since #1274 the common startup runner owns a reloaded stream's first Play; the claim
hold's release resumed through the Feed door, which committed the transport to playing but
left the runner's startup goal paused. release now uses the viewer-press door (backend control
first, the direct resume only with no attempt), which turns that goal to Play.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…im_hold docs

The regression test now grades the reloaded stream on the physical sink for both start
shapes: the progressive immediate-Play start and a segmented-HLS start that primes before
Play (the runner's Play goes through ResumeInitial and the prime proof). Both fill the
reloaded Engine's lanes past the prime thresholds and require the sink's Play, an open feed
gate and an advancing clock. claim_hold's module doc no longer says the give-back calls
super::resume directly, and the accepted-landing unit test's doc says it covers only the
no-attempt fallback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit b2cade5 into main Nov 8, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the fix/transcode-seek-landing-play branch November 8, 2026 23:48
GLinnik21 pushed a commit that referenced this pull request Nov 10, 2026
## What broke

Two defect classes, both found in field testing on a real television (LG
webOS, armv7l) against a real PMS server (1.43.5):

1. **The retranscode stall** — the last unhandled retranscode path. #1285
   and #1286 covered the transcode *seek* (cold resume admitted at the Feed
   start door, play given back through the startup runner). The remaining
   path is the initial *drop*: a title plays direct, the quality ladder
   drops it, the retranscode lands — and then nothing plays. The log shows
   the pre-Load Play refused, and no further Play is ever attempted; the
   native buffer caps out (`BufferFull`), `pos_ms` stays 0.
2. **Codec declaration kills** — a single title kills playback: The Last
   Duel (an AAC file declared eac3 — the 7.1/AAC kill class — the video
   sink wedges under audioSync); DTS titles refused at Load (the DTS family
   declared `dca` where the demuxer says `dts`); and stale PMS declarations
   lying on **both** codec axes at once, so the one-shot corrective retry
   spent its reload without a single frame playing.

## Why

1. Since #1274 a retranscode landing starts its new stream PAUSED and hands
   the first Play to the user's Resume (the feed_pump Deferred branch) —
   never through the runner's `Operation::Play` — so
   `startup_play_commanded` stayed false. `try_prime`'s startup gate
   (`startup_controlled && !startup_play_commanded`) then blocked the
   prime's post-Load retry **forever**: `play_initial_now`'s physical Play
   landed before the Load worker's Starfish call, was refused, and the code
   never tried again — hence `BufferFull` at the native cap. The physical
   native hold (claim_hold) and the viewer pause goal were also conflated,
   which is what Changes 1-3 of the first commit untangle.
2. `fill_direct_plan` declared the PMS track's `achosen` (or the file's
   default) where the demuxer actually feeds a different codec; a
   single-axis probe on a refused start corrected only the first axis it
   hit, leaving the second mismatched — the one-shot retry then fired on a
   start that was still wrong.

## The fix

1. The Deferred branch now **latches `startup_play_commanded` before firing
   `play_initial_now`**: if the Play is refused pre-Load, the prime stays
   armed (`Held{Initial}`, `user_held` cleared, `resume_acb_pending` set)
   and `try_prime` issues it once loadCompleted has passed and both lanes
   are primed; the Accepted path mirrors `resume_acb` to the player.
   Plus Changes 1-3: the physical hold (`OpenRequest.start_paused`) is
   decoupled from the viewer pause goal (`InitialPlayback.paused`), so the
   post-Load resume path can actually run the clock.
2. **Declare what the pipeline actually feeds** (no-pick → the file's
   default codec; pick → the picked track's codec), map the DTS family to
   `dts`, and probe **BOTH** declared-codec axes in one pass so a single
   corrective reload fixes them together. One-shot, failure-path only —
   nothing in the happy path changed.

## Tests

- `plx_play_feed`: 300/300 pass; `plx_media` suite green, including the
  new 16-cell audio/video declaration matrix (the 7.1/AAC kill class).
- **Live on tv01** — The Dark Knight: 4K direct → 480p drop → retranscode
  at 16 s; the pre-Load Play was refused, then
  `primed: v=791ms a=317ms runway=0ms -> Play` fired after loadCompleted,
  ACB play=1, position advanced 31.4 s → 49.5 s through the timeline end
  with ok=1 and no BufferFull. The initial-transcode regression path
  (direct → retranscode at start) is green: pos 24.6 s → 47.8 s, ok=1.
- `make check` (cargo half), `make check-nodef` and the ARM cross-check:
  green. `make check-cargo` (clippy clean, 18 test binaries in
  parallel): 17/18 pass; the single failure
  (`app::adapters::session::tests::a_signin_after_signout_behind_a_read_only_mount_is_written`)
  did not reproduce — the full lib suite re-ran green (1281/1281, 99 s)
  and the same test passes in isolation on the sibling fifo-API branch.
  is a pre-existing harness race under this container's parallel load,
  not a regression from this branch (this diff touches play-feed, net and
  media route/pump code — no session/storage code). `make check-nodef`
  (`cargo check --lib --no-default-features --features play-uri,play-feed`):
  green. ARM cross-check (cortex-a9, NEON off, frame pointers, debuginfo):
  green. The python half of `make check` — see the host-only note
  below.
- The first CI run on this head caught a real regression the local
  default-feature gates do not cover: `check-cargo-unit-hostsim` runs the
  hostsim suite, where
  `player::pump::flight_tests::an_automatic_direct_original_recovery_flies_without_pausing_the_stream`
  was red. The claim-landing tail recorded `set_reconfigure_pause_goal(!hold)`
  for EVERY landed claim — including hold-less ones — and a hold-less
  claim (the direct Original recovery, no PMS round trip) landed on a
  paused stream. Fixed in `00e0eb37b`: the play goal is recorded only for
  claims that actually held presentation; hold-less landings fall back to
  the stream's own transport state (`feed_start_paused` reads
  `readout().paused()` when no goal is set). The held (retranscode) path
  is behaviourally unchanged — `Some(false)` before and after — so the
  live-verified 4K→480p landing is unaffected. All gates re-ran on the
  fix commit: `make check-cargo` (lint + 18/18 unit binaries, app
  1281/1281), `make check-cargo-unit-hostsim` (18/18 binaries, the
  plx_media hostsim 2332-test suite green, the previously failing flight
  test passing), `make check-nodef`, ARM cross-check.
- Rebased onto `main` (includes #1297, the key-mode TLS session-resumption
  fix — no interaction with this change).

Local note (host only, pre-existing): the python half of `make check`
carries two failures on this workstation — `ci/test_build_gc.py` (16 of 58)
and `ci/test_disk_preflight.py` (1 of 30). This container masks
`/proc/mounts` and `/proc/1`, so `lsof` cannot enumerate open files; the
`tools/disk-budget.py` liveness probe then reads `unknown` and, by design,
fails closed — every fixture tree is kept as `liveness unknown (no lsof)`.
Both tests fail identically on a clean checkout of `af607d8cd` (upstream
`main`): the environment, not this branch; CI runners have a full `/proc`.

The five codec-declaration commits and the two retranscode commits are one
verified unit: the stall fix was developed and tested on the tree with the
declaration fixes in place, and the live verification above ran with all
seven.
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