Skip to content

Playback: a Dolby Vision resume or seek that lands on a CRA plays the HDR10 base layer - #1263

Merged
GLinnik21 merged 10 commits into
mainfrom
fix/1166-dv-cra-landing
Nov 6, 2026
Merged

GLinnik21 merged 10 commits into
mainfrom
fix/1166-dv-cra-landing

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1166

Cause

The reporter's TV (LG OLED CX, webOS 5.5.0-19 jhericurl-jervisbay, firmware 04.50.90) has a Dolby Vision splitter, libgstdvsplitter.so (SHA-256 prefix 0cda1717, version 0.2.1/0.1.0, the one in the reporter's trace). After the pipeline starts or flushes, it only lets a picture through once it has seen an IDR (HEVC NAL type 19 or 20). In gst_dvsplitter_chain, the frame-type table only maps those two types to the branch that ends the "search first IDR" state. CRA (21) and BLA (16-18) only increment a counter, so the splitter goes on skipping every buffer. Only a start or a flush ends that wait. webOS 5.6.2 has the same code, but its table also accepts 16-21.

The same table was then read in the other archived images that have a splitter:

webOS Codename Splitter SHA-256 First picture accepted
4.10.2-31 goldilocks2-grampians b38aedc9, 4096b724 NAL 16-21 (a CRA is fine)
5.5.0-19 jhericurl-jervisbay 0cda1717 IDR only (19, 20)
5.6.2-21 jhericurl-jimna e03029b2 NAL 16-21
6.5.3-47 (LG C1) kisscurl-koli 239b3e04 IDR only (19, 20)

So the LG C1 has the same gate as the reporter's CX.

The reporter's film has a single IDR, at 0:00. Every later keyframe is a CRA. A resume or seek therefore lands on a CRA and the splitter skips everything after it: no picture, Buffering for ever. With Dolby Vision Off in the app the splitter is not in the pipeline, which is why the reporter's resume and seek then work. The feed-ahead throttle is not the cause.

This was read from the reporter's exact firmware image and checked against the disassembly. No vendor code is in this PR: docs/measurements/issue1166-cra.md records the evidence.

What changes

On a Dolby Vision direct play, a resume or seek that lands on a keyframe the splitter will not show now reloads once without the Dolby Vision declaration. The HDR10 base layer then plays (Profile 8.1).

  • Classifying the keyframe: the demux thread records each HEVC keyframe as an IDR or as another random-access type (packet_to_annexb, carried on AuNode.key).
  • The firmware rule: the shared devcaps exclusions table gets a dv-first-picture=idr row for jhericurl-jervisbay (5.5.0-19) and one for kisscurl-koli (6.5.3-47, the LG C1). The row reaches the player through the play attempt's caps, so no new global read is added. Debug builds have a switch, the file /tmp/plxnative-dvfirstpicture containing idr or any.
  • The guard, player/dv_start.rs: one pure guard per Engine, which reads no clock or registry.
    • Under the row, the landing keyframe is held unfed and gets no native Seek. The pump then withdraws the declaration on the route and calls reload_at once.
    • On any firmware, a landing that was fed and anchored but gets no position update for 4 s, after 700 ms of video was accepted, is withdrawn and reloaded the same way. This covers 5.x builds nobody has read.
    • The pump runs it before the seek stuck-watchdog, which stands down while a withdrawal is pending. The reload target is read when the reload is taken, so a seek tap made meanwhile wins.
  • How long it lasts: the withdrawal rewrites the stored presentation (stream_dv_decision, src_dv_decision, and the stored Auto Original candidate) to what Dolby Vision Off would have planned. The probed capability is kept. The rest of the play stays HDR10, including a seek back to 0:00. The next play starts with Dolby Vision again.
  • Report only: a Profile 5 direct play (no base layer to fall back to) and a remux that copies the Dolby Vision video only log the landing. They are never withdrawn.
  • Logging: dv: withdrawn for this play: ... names the cause, and the rebase: line gains irap=.
  • The audio stall watch: native_stall no longer counts a held landing as an audio stall, so a held keyframe cannot record a learned Opus refusal for the whole install.

Tests (written first, seen failing)

Commit 1 adds the tests and stubs. On that commit:

  • make test-crate C=plx_media T=irap_class: test result: FAILED. 2 passed; 2 failed
  • make test-crate C=plx_platform T=dv_first_picture: test result: FAILED. 1 passed; 2 failed
  • make test-crate C=plx_media T=dv_withdraw: test result: FAILED. 1 passed; 5 failed
  • make test-crate C=plx_media T=dv_start: test result: FAILED. 3 passed; 8 failed
  • make test-hostsim C=plx_media T=dv_start_pump_tests: test result: FAILED. 0 passed; 11 failed. The first case fails because one native Seek was made on the CRA landing: that is the reported hang.

At f678db7de, after the fix:

  • irap_class: ok. 4 passed
  • dv_first_picture: ok. 3 passed
  • dv_withdraw: test result: ok. 6 passed; 0 failed
  • dv_start: test result: ok. 11 passed; 0 failed
  • make test-hostsim C=plx_media T=dv_start: test result: ok. 22 passed; 0 failed

The review follow-ups (3bab09c59) add three tests:

  • dv_withdraw_downgrades_the_stored_original_candidate_too;
  • a_held_landing_is_not_a_native_stall;
  • the two cases ordering this guard against the surround-Opus stall watchdog.

CI compiled them first. One of the ordering cases failed there because of the unit rig: its reload_at has no URL, so the Engine survived the withdrawal and its stall watch fired 106 ms after the Dolby Vision watch. In production the reload replaces the Engine. 7cedadfcb stops that case at the reload attempt. Locally: make test-hostsim C=plx_media T=dv_start_pump_tests: test result: ok. 14 passed; 0 failed.

The C1 row (bba8626b9, 32e8d8798) adds dv_first_picture_c1_family_takes_only_an_idr. It also updates the C1's existing devcaps tests, which assumed the codename had only audio rows: the applied list now ends in dv-first-picture=idr, and the nativeaudiowide tests check that only the audio rows are skipped. Locally, on 32e8d8798:

  • make test-crate C=plx_platform T=devcaps: test result: ok. 70 passed; 0 failed
  • make test-crate C=plx_platform T=dv_first_picture: test result: ok. 4 passed; 0 failed
  • make test-hostsim C=plx_media T=dv_start: test result: ok. 25 passed; 0 failed
  • make test-hostsim C=plx_media T=a_native_audio: test result: ok. 6 passed; 0 failed

Gates

CI on 32e8d8798 (with the C1 row) is green, as it was on 7cedadfcb: the hostsim unit tests (plx_media and every other crate), the default-features unit tests, lint and type checks, the harness tests, the armv7 cross-build and artifact assertions, the macOS and Linux simulators, and CodeQL. Run locally: bash ci/check-deps.sh (all gates green), and git diff origin/main -- ci/allow tests/test_harness.py is empty.

Reviews of the combined diff:

  • Firmware compatibility: no FFI, symbol, dynlib! or DT_NEEDED change.
  • Doc-claim audit: its four findings are fixed in 3bab09c59.
  • One code review: no blocker or major finding. Its one minor point was a prose sentence, also fixed.

What is proven and what is not

Host tests show:

  • every random-access type is classified correctly;
  • the rows' keying (jervisbay and kisscurl-koli on, with or without the nativeaudiowide flag; jimna, grampians and unknown off) and that it reaches the guard through the attempt's caps;
  • a declared direct play landing on a non-IDR keyframe under the row is reloaded exactly once, at the right target, with no native Seek and a payload without DolbyHdrInfo;
  • the watch fires once after 4 s and never while paused, under-fed or after a position update;
  • the withdrawal persists across later Loads of the route;
  • Profile 5 and declared remuxes are only reported;
  • plays without Dolby Vision are untouched.

Not proven:

  • that 5.5.0-19 shows a picture from a CRA start once the declaration is gone. That is the reporter's Dolby Vision Off observation, not ours;
  • whether 4 s fits real first-update times on any 5.x set;
  • the panel switching from Dolby Vision to HDR10 on the reload;
  • that the C1 hangs the same way: its row comes from reading its firmware image, not from a set;
  • whether W20P (the same build, no splitter) declares Dolby Vision at all;
  • a server remux that copies Dolby Vision video landing on a CRA;
  • a firmware that keeps reporting position while showing nothing would never trip the watch, though the row still covers a listed build.

Not yet run on the dev TV. The dev set runs 4.10.2, whose splitter accepts a CRA, so it cannot reproduce #1166. What it can check: an IDR landing still plays, a CRA landing without the row plays and the 4 s watch does not fire on it, and a CRA landing with the row forced on (/tmp/plxnative-dvfirstpicture = idr) withdraws once, reloads and plays.

Out of scope:

  • the fresh-Load and in-place-seek throttle mismatch (a separate cleanup);
  • priming the splitter with the frame-0 IDR;
  • a rung for Profile 5 or for remuxes;
  • telemetry for withdrawals.

🤖 Generated with Claude Code

GLinnik21 and others added 10 commits November 6, 2026 16:53
…tests

The inert vocabulary of the #1166 fix, and the regression tests that fail against today's behaviour:

- packet_to_annexb returns a Keyframe class (No, Clean, HevcIrapNotIdr(t)) and the demux loop queues
  kf.au_key(); aq.rs names the AuNode.key encoding (AU_KEY, hevc_irap_not_idr). Every IRAP still
  answers Clean.
- devcaps: Exclusion takes a Limit (Audio, DvFirstPictureIdr); Caps::dv_first_picture (DvFirstPicture,
  AnyIrap by default) joins every Caps literal. No row yet.
- route: dv_first_picture(ps) reads the attempt's caps; dv_withdrawable and withdraw_dv_presentation
  answer false; test setters for the source declaration.
- player/dv_start.rs: the pure Guard, Probe, Landing, Step and Withdrawal types (inert), engine
  dv_start_for returning the inert guard, the Engine field, and the in-place seek apply block's re-arm.

Failing runs observed before any behaviour change (the reported hang shows as one native Seek and no
reload in the pump case):

make test-crate C=plx_media T=irap_class
  test result: FAILED. 2 passed; 2 failed; 0 ignored; 0 measured; 2194 filtered out; finished in 0.00s
make test-crate C=plx_platform T=dv_first_picture
  test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 371 filtered out; finished in 0.00s
make test-crate C=plx_media T=dv_withdraw
  test result: FAILED. 1 passed; 5 failed; 0 ignored; 0 measured; 2192 filtered out; finished in 0.00s
make test-crate C=plx_media T=dv_start
  test result: FAILED. 3 passed; 8 failed; 0 ignored; 0 measured; 2187 filtered out; finished in 0.00s
make test-hostsim C=plx_media T=dv_start_pump_tests
  test result: FAILED. 0 passed; 11 failed; 0 ignored; 0 measured; 2432 filtered out; finished in 0.01s
  (a_native_seek_landing_on_a_cra_under_the_cx_row_reloads_once_without_dolby_vision: "the keyframe
  the splitter would skip is not fed, so no native Seek"; with_no_row_..._after_4_s: no reload after
  10 s of frames)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…DR IRAP

packet_to_annexb's pass 1 now names the first IRAP NAL's class: an IDR (19, 20) stays Clean, a BLA or
CRA (16 to 18, 21) and the reserved IRAP types (22, 23) become HevcIrapNotIdr(type). The demux loop
already queues kf.au_key(), so the access unit's key now carries the NAL type for the frame thread's
landing guard, and `key != 0` stays "is a keyframe" for every other reader. The `ff: AU#0` line names
the class (irap=CRA(21)). H.264, AV1 and VP9 framings still write 1.

make test-crate C=plx_media T=irap_class
  test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 2194 filtered out; finished in 0.00s
make test-crate C=plx_media T=ff::
  test result: ok. 249 passed; 0 failed; 39 ignored; 0 measured; 1910 filtered out; finished in 6.82s

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ter IDR-first

The shared per-firmware table gains its first non-audio row: webOS 5.5.0-19 (`jhericurl-jervisbay`)
carries a Dolby Vision splitter that takes only an HEVC IDR as the first picture after its init or a
flush, so Caps::dv_first_picture reads IdrOnly there and AnyIrap on every other set (5.6.2-21
`jhericurl-jimna` admits CRA and is not named). The row is not an audio row, so the nativeaudiowide
debug flag does not skip it; the dvfirstpicture dev trigger (a file holding `idr` or `any`,
devtriggers builds) forces the value either way for this run. The boot `devcaps:` line already lists
what was applied, now `dv-first-picture=idr` for that codename. No new devcaps::caps() read: the
guard reads the value through the attempt's caps (route::dv_first_picture).

make test-crate C=plx_platform T=dv_first_picture
  test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 371 filtered out; finished in 0.00s
make test-crate C=plx_platform T=devcaps
  test result: ok. 69 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out; finished in 0.00s
make test-crate C=plx_plex T=transcoder
  test result: ok. 53 passed; 0 failed; 0 ignored; 0 measured; 716 filtered out; finished in 0.01s

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hdrawn and reloaded once

route::dv_withdrawable and route::withdraw_dv_presentation rewrite the installed route's stream and
source Dolby Vision decisions to exactly what Dolby Vision Off would have planned (the probed
capability kept), logging `dv: capability=... presentation=base-layer (withdrawn: why)`. Every later
Load of the route is then a base-layer play.

player::dv_start::Guard now carries its rules: at a landing (an in-place seek's first keyframe, a
fresh Load's armed target, or a start's first keyframe) an Act guard on an IDR-only set withdraws for
a non-IDR IRAP, a ReportOnly guard (a Profile 5 direct play, a remux that copies the video) says so
once, and every other landing starts the watch, which fires once after 4000 ms of running clock with
at least 700 ms of video accepted and no position update. engine::dv_start_for builds it from the
route; feed_stream asks it at the landing before any native Seek or pts_shift write, holds the
keyframe and both lane feeders while a withdrawal is pending, and the `rebase:` line names the class
(irap=CRA(21)). The pump's driver runs before the native-audio stall check and the seek
stuck-watchdog (which yields), waits out a flight, reads the reload target when it takes the
withdrawal (the newest coalesced tap first) and calls reload_at once. The shared sends_dolby_hdr_info
predicate is the one the Load's node splice and the guard's arming both ask.

make test-crate C=plx_media T=dv_start
  test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 2187 filtered out; finished in 0.00s
make test-crate C=plx_media T=dv_withdraw
  test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 2192 filtered out; finished in 0.00s
make test-hostsim C=plx_media T=dv_start
  test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 2421 filtered out; finished in 0.01s

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

player/CLAUDE.md gains the one mid-play change to the frozen presentation (dv_start.rs), the
unanchored landing in the in-place seek bullet, the DV row in the EXCLUSIONS layer list and the
frames counter's new reader. docs/dolby-vision.md section 1 states the webOS 5.5.0-19 rule, the 4 s
watch, what the viewer sees, that Profile 5 and declared remuxes are only reported and why
platform_gate is not the vehicle; section 5 names the dvfirstpicture trigger; section 7 lists the
unread 4.10.2 and 6.5.3 tables, the unmeasured threshold and the position-update proxy. The #1166
measurement note no longer says the affected 5.5 splitter was never found: it is archived.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… Original candidate and the audio stall watch

Review follow-ups to the #1166 landing withdrawal.

The stored Auto Original candidate (`AutoOriginalCandidate.dv_decision`) is installed verbatim by
`recover_original_direct`, so a play that was withdrawn, fell to HLS (Auto's fallback, a fixed rung,
an enhanced remux) and came back to Original would have declared the node again and met the same
landing a second time. `withdraw_dv_presentation` now downgrades the candidate the same way it
downgrades the installed route and the file's own declaration, through one shared
`dv_off_decision_for`; a test in the `dv_withdraw` group shows the candidate no longer declares the
node and that a refused (Profile 5) withdrawal leaves it alone.

While a row-held landing waits for its reload neither lane feeds, so `native_stall` could see no
accepted audio for 4 s on a native 5.1 Opus play with no picture and write an install-wide learned
Opus refusal for a fault that does not exist. `native_stall::Probe` gains `landing_held`, read from
`dv_start::Guard::landing_held`, and a held landing is not a candidate (the window restarts when it
lets go). Pump cases: the DV watch fires first on a declared play with native 5.1 Opus after the
prime released Play and no refusal is raised; a stall before the prime leaves only `native_stall`;
a held landing never arms the audio watch.

Prose the change made false: the player guide split the row (holds the keyframe, no native Seek)
from the 4 s watch (fires after the landing was fed and anchored); issue1166-cra.md named a private
channel for a binary that is archived and read, and now says what is still open; `nativeaudiowide`
skips only the audio exclusions (comment and both boot-log suffixes); `stream_dv_decision` is no
longer "frozen" but rewritten by `withdraw_dv_presentation` alone; the withdrawal's scope is the
play request's installed route and the Original it can return to.

Not compiled or run on this tree: every `make` sat in `disk-budget.py preflight` past 15 minutes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…he withdrawal's reload

The case stepped the pump 6 s past the withdrawal. In the unit rig `reload_at` has no url,
so the reload fails synchronously and the Engine survives with its audio stall watch still
running; the stall verdict then came a frame after the withdrawal and the "watchdog stayed
out of it" assertion failed. Production replaces the Engine at the reload, so that later
state does not exist there.

The case now steps only until the first reload attempt and asserts what the plan's D5
claims: the watch withdrew Dolby Vision (cause: no position update), once, at the landing,
and no audio stall line or learned Opus refusal came before it. The `landing_held` assertion
is dropped: it modelled a state the rig does not have after the withdrawal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds a kisscurl-koli DvFirstPictureIdr row beside the C1's two audio rows. Evidence: the
6.5.3-47 image's libgstdvsplitter.so (sha256 239b3e04...) dispatches on the NAL type through
a tbb table at 0x5b1a where only 19 and 20 set the found-first-IDR latch, the same result as
5.5.0-19's; read by disassembly, the hang was not observed on a C1. The 4.10.2 splitter
admits 16 to 21 (CRA first is fine), so it gets no row.

devcaps tests: new dv_first_picture_c1_family_takes_only_an_idr; the tests that took
kisscurl-koli for an audio-only family now expect the Dolby Vision row beside the audio
ones, and the nativeaudiowide ones still prove the audio rows are the skipped half.
Prose names the C1 beside 5.5.0-19 and the measurement doc carries the splitter census.

Refs #1166

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…the channel table

The set's Auto table already lists Opus at two channels, so the audio_channels maps of a run
with and without the flag are equal; the Opus row's mark is the Force Direct Play ceiling
(native_ceiling), which forced_feeds_audio_track reads.

Refs #1166

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review November 6, 2026 21:52
@GLinnik21
GLinnik21 merged commit 2f5e796 into main Nov 6, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the fix/1166-dv-cra-landing branch November 6, 2026 21:53
@GLinnik21 GLinnik21 mentioned this pull request Nov 6, 2026
1 task done
GLinnik21 added a commit that referenced this pull request Nov 7, 2026
Brings main's 2f5e796 onto the Feed/neutral-player split. The neutral half
(route::withdraw_dv_presentation, devcaps' dv_first_picture row, the plan tests,
the PMS transcoder hunk, the #1166 measurements) merged in place. The physical
half moved to play-feed: aq.rs (AU key, hevc_irap_not_idr), ff.rs (Keyframe,
packet_to_annexb pass 1, demux kf), native_stall.rs (landing_held), dv_start.rs
(the pure Guard and its unit tests), the Engine's dv_start field, the landing
hooks in native_executor.rs, and the stuck-seek / audio-stall yields and the
in-place-seek re-arm in feed_pump.rs.

The two crossings between the player and the Feed (design choice A):
- Arming: OpenRequest.dv_landing (DvLandingPlan { mode, idr_first }) carries the
  route's facts; media's feed_open::dv_landing_plan (route-only, with
  sends_dolby_hdr_info hoisted beside payload_options) states them and the Feed's
  Engine constructor builds its Guard from the plan (Guard::from_plan), reading the
  armed seek from its own mailbox.
- Withdrawal: one FeedLoad verb, dv_landing_due(now, route_flight) ->
  Option<DvWithdrawal>, called by pump() before native_audio_stall_fired; the Feed
  builds the Probe from its own Engine and mailboxes, steps the guard and logs the
  report-only lines. The player runs the neutral half (withdraw_dolby_vision:
  route withdrawal, the newest tap through take_pending_seek, FeedRaw
  seek_target_ns, reload_at). A route that refuses answers FeedCommand::DvStandDown.
  Feed trait surface 40 -> 41 methods (limit 42); the contract's Mode is shared
  (DvLandingMode), and the dv: withdrawn line is media's.

dv_start_pump_tests.rs is ported to integ's Rig (every test kept, plus one for the
refused withdrawal / DvStandDown path). Prose naming the old seam (player/CLAUDE.md,
docs/dolby-vision.md, aq.rs, decision.rs) is reworded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Nov 7, 2026
GLinnik21 added a commit that referenced this pull request Nov 7, 2026
…io, plx_base::clock, LoadVideo in platform, contract landing plan (#1272)

Moves the lower-layer pieces the backend-neutral media code reads below `plx_media`, with no
backend named:

- The HTTP range transport moves from `media/src/curlio.rs` to `plx_net::range_io`, with its
  `curl_multi_*` `dynlib!` table (same symbols, candidates and one `Once`). `media::curlio` stays
  as the Plex credential facade over it, so its callers are unchanged.
- `plx_base::clock` holds the monotonic clock `player::vclock_ms` now delegates to.
- `LoadVideo` moves to `plx_platform::devcaps`; media's `engine::LoadVideo` re-uses it.
- Plex `MediaPart.duration` and data `PlayingItem.duration_ms`.
- The playback contract gains the Dolby Vision landing plan and withdrawal, `dv_landing_due`,
  `DvStandDown`, `stop_begin(terminal)` and `ServerStopped`, matching #1263 and #1265 on the
  integration branch; nothing on main calls them yet.

`range_io` now asks the URL authorizer again at the start of a seek or reopen. That has no
production effect today (curl sources are https, and a TLS origin is always allowed). With it, a
start that returns early resets the attempt state, so a read after a refused seek fails instead
of returning stale bytes and a clean end of stream.

Related: #1064

Co-Authored-By: Claude Opus 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.

Every seek or resume hangs on Buffering

1 participant