Skip to content

Default to a version the set can decode - #1245

Merged
GLinnik21 merged 16 commits into
plxnative:mainfrom
PilaScat:feat/default-version-fits-panel
Nov 8, 2026
Merged

GLinnik21 merged 16 commits into
plxnative:mainfrom
PilaScat:feat/default-version-fits-panel

Conversation

@PilaScat

@PilaScat PilaScat commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PMS lists the highest version first, and a play without a picked version sends mediaIndex=0. On a set whose decoder stops at 1080p, that first version is a 4K copy it can only receive as a transcode, even when a 1080p copy sits next to it and would play directly.

The set behind this is an LG 32LQ63006LA (webOS 7.6, k8ap). Its device table gives HEVC 1920x1088, which PlxNative already reads (devcaps: hevc=true 1920x1088). In its event log, a film with both copies starts with start.mkv and mediaIndex=0, and picking Original logs source 75086kbps 3840x2160; re-transcoding this playback. Its 1080p copy is 11.5 Mbps H.264.

What changes

  • When the first version cannot play directly, the default becomes the highest version the decoder takes. If it takes none, the default is the smallest version, which is the cheapest to transcode. Within one resolution class, PMS's own order decides.
  • The test is the existing video_direct_plays, so there is no new capability read. It uses the same bound as the direct-play gate, including the attempt's ceiling after a recovery, so a 4K the set refused gives way to the 1080p on the retry.
  • The class is PMS's videoResolution, else the frame size, using the width buckets of ui::fmt::resolution, so the choice and the version list's badge agree.
  • The choice happens in build_stream, where the item is fetched (fetch_playing_item_choosing). Play, resume, Continue Watching and next-episode autoplay all get it, through the PlayedVersion path Play Version: pick which version of a movie or episode plays #955 built: the part, codecs, mediaIndex, MDE ask, decision and start URL are all that version's.
  • A detail page's cached copy describes Media[0], so request_env drops it only when another version would play. Otherwise it costs no extra GET.
  • When the worker plays another version, the quality ceiling, src_measure and the transport fallbacks measure that version's own Media.bitrate, not the first version's rate.
  • A retry keeps its audio and subtitle ids only on the Part they came from (HeldSelection). When it resolves another version, that Part's tracks are chosen by the ordinary rules.
  • Unchanged:
    • a first version that plays directly, so a 4K set behaves as before;
    • a picked version (Play Version), which always wins;
    • Force Direct Play, which always attempts the first version.

Verified

  • make check is green on 7561145, which has main at 3ae2ebf merged in: 43 suites, 25502 passed, 0 failed, 198 ignored.
  • make check-nodef is clean, and the armv7 cargo check of plx_data and plx_media passes.
  • Each regression test fails without its change:
    • a_1080p_decoder_plays_the_1080p_version_listed_after_the_4k: mediaIndex 0, expected 1;
    • a_fixed_quality_measures_the_1080p_version_it_resolved: measured 0 kbps instead of 2372;
    • a_retry_that_moves_to_the_1080p_version_does_not_carry_the_4k_tracks: sent the 4K's audioStreamID=31302 for part 3134;
    • force_direct_play_attempts_the_4k_original_listed_first: played part 3134 instead of the 4K original.
  • The host runs were on WSL2, kernel 6.18. There, ci/test_check_collisions.py fails at random with "ThreadSanitizer: unexpected memory mapping", on main as well, so the gates ran under setarch -R.

Not verified

  • Not run on a television yet. CI builds a debug IPK for this PR. I'll run it on the 32LQ63006LA with normal Play on a film whose 4K copy is listed first, and post the log excerpt in this PR before it merges.
  • A 1080p panel with a 4K decoder would still start the 4K. I haven't seen such a set.
  • A Dolby Vision first version the set refuses stays the default and is transcoded, as it is today. The choice passes NotDv, because listing rows rarely carry the stream facts the refusal needs. Left as a follow-up.
  • The detail page's playback hint still describes Media[0], so on such a set it can say a film converts when Play will direct-play the 1080p copy. Left as a follow-up.
  • A swapped-in version is measured by its whole-file rate, while the first version uses its video stream's rate when PMS gives one. Near a rung's limit that errs toward re-encoding.

Correction

An earlier version of this PR added a getSystemInfo UHD probe and said this set decodes 4K HEVC. That was wrong: I inferred it from Tautulli's rows instead of reading the set's table, and the table says 1920x1088. The existing bound already answers the question, so the probe and devcaps::panel are gone. Their commits are still in this branch's history, with the wrong claim in one message; the last commit replaces them, and the diff here is the result. The two Copilot threads refer to the earlier version; the overflow fix is still here, and the other thread's code no longer exists.

🤖 Generated with Claude Code

PilaScat and others added 2 commits November 5, 2026 20:29
The capability probe already asks configd for Dolby Vision on its own LS2
registration. On the same registration it now asks
com.webos.service.tv.systemproperty/getSystemInfo for the UHD key, which
LG documents as "whether the TV supports Ultra HD resolution" since
webOS TV 1.2, and publishes the answer in devcaps::panel: Uhd, NotUhd,
or Unknown when the call fails, times out or answers anything but the
documented "true"/"false" string.

The decoder table cannot answer this: a 1080p set whose SoC decodes
4K HEVC lists a 4K row, so nothing today tells it apart from a UHD set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
PMS lists the highest version first, and a play without a picked version
takes Media[0], so a 1080p set direct-plays or transcodes the 4K copy of
every title that also has a 1080p one.

With the panel known, the default is now the highest version that does
not exceed it; if every version does, the smallest one. Within one
resolution class the version the set decodes directly wins, then the
higher bitrate. An unknown panel, a picked version and single-version
items behave exactly as before.

The choice is made where the item is fetched (build_stream), so Play,
resume, Continue Watching and next-episode autoplay all get it. A detail
page's cached copy describes Media[0], so request_env drops it only when
the panel would play another version, and carries that version's rate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
Copilot AI lite review requested due to automatic review settings November 5, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two moderate active issues remain: unchecked dimension multiplication can overflow on malformed input, and panel capability probing is skipped when diagnostic overrides are enabled.

2 open issues
What changed in this PR

This pull request adds panel-aware media version selection so playback defaults to the version best suited to the detected webOS TV resolution while preserving explicit version choices and unknown-panel behavior.

Changes:

  • Adds an ARM-only webOS UHD capability probe and cached panel capability state.
  • Selects media versions by panel-compatible resolution, direct-play support, and bitrate.
  • Integrates selection into playback planning, metadata fetching, cached details, and regression tests.
  • Requires fixes for dimension-overflow handling, consistent resolution classification, and probing when diagnostic overrides are active.

This pull request requires changes.

File Summary
rust-modules/​platform/​src/​webos/​caps.rs Probes and parses the webOS UHD capability through LS2; the panel probe must also run when diagnostic overrides are active.
rust-modules/​platform/​src/​devcaps/​panel.rs Defines and caches Unknown, NotUhd, and Uhd panel states.
rust-modules/​platform/​src/​devcaps.rs Exposes the panel capability module.
rust-modules/​media/​src/​route/​plan.rs Selects the best panel-compatible media version during stream planning; dimension arithmetic and fallback classification need correction.
rust-modules/​media/​src/​route/​plan_panel_version_tests.rs Tests resolution classification, fallback behavior, and panel-aware version ranking.
rust-modules/​media/​src/​route/​decision.rs Captures panel capability and invalidates incompatible cached defaults.
rust-modules/​media/​src/​route/​decision_version_tests.rs Verifies panel-aware media index, part, codec, and cache behavior.
rust-modules/​data/​src/​metadata.rs Adds metadata fetching with caller-selected version resolution.

Review effort: Lite

Comment thread rust-modules/media/src/route/plan.rs Resolved
Comment thread rust-modules/platform/src/webos/caps.rs Resolved
- frame_class: the fallback for a version without videoResolution now
  uses ui::fmt::resolution's width buckets, with saturating arithmetic
  on the height-derived width. A garbage wire dimension cannot overflow,
  and the class matches the badge the version list shows.
- run_probe: an armed dvcaps0/dvcaps1 replaces only the configd answer;
  the transport still registers and runs the panel probe.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
Copilot AI lite review requested due to automatic review settings November 5, 2026 20:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Real-TV validation is still needed to confirm anonymous LS2 permissions, firmware response shape, and panel-dependent first-play behavior.

No open issues 🎉

2 resolved since last review

Review effort: Lite

PilaScat and others added 2 commits November 6, 2026 12:44
PMS lists the highest version first, and a play without a picked version
takes Media[0]. On a set whose decoder stops at 1080p, that first version
is a 4K copy it can only receive as a transcode, even when a 1080p copy
sits next to it and would play directly.

When the first version cannot play directly, the default is now the
highest version the decoder takes. If it takes none, the smallest one,
which is the cheapest to transcode. Within one resolution class PMS's
own order decides. The test is video_direct_plays, so it uses the bound
the app already reads from the device table, and the attempt's ceiling
after a recovery.

A first version that plays directly changes nothing, so a 4K set behaves
as before, and a picked version always wins.

The choice is made where the item is fetched (build_stream), so Play,
resume, Continue Watching and next-episode autoplay all get it. A detail
page's cached copy describes Media[0], so request_env drops it only when
another version would play, and carries that version's rate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
Takes the tree of 18b0130, which is based on current main. The set's
device table already says 1920x1088, so the UHD probe and devcaps::panel
are gone, and the default version comes from video_direct_plays.

Signed-off-by: Filippo Scatigna <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 6, 2026 11:54
@PilaScat PilaScat changed the title Play the version closest to the panel by default Default to a version the set can decode Nov 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An active moderate issue can retain an unplayable Dolby Vision version because the direct-play gate omits refusal-relevant DV facts, causing an unsuitable choice and fallback transcoding instead of a playable alternative.

1 open issue

Review effort: Lite

Comment thread rust-modules/media/src/route/plan.rs Resolved
@GLinnik21

Copy link
Copy Markdown
Collaborator

Nice catch!

One conflict, in decision_version_tests.rs: main's loopback PMS now takes the item body as a
parameter; the rk-4k route this branch adds is kept beside it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>

@GLinnik21 GLinnik21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down and adding the playback regression test. Please update the branch against main to resolve the conflict and address the three inline playback issues, with regression coverage for fixed quality, retry after a version switch, and Force Direct Play.

I'm fine keeping Dolby Vision-aware selection and the detail page's playback hint as follow-ups. Once we have a test build, could you verify on the 32LQ63006LA that normal Play selects the 1080p copy directly when Plex lists 4K first? Let's get that result before merging.

Comment thread rust-modules/media/src/route/plan.rs Resolved
Copilot AI lite review requested due to automatic review settings November 7, 2026 23:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

danzig666 and others added 5 commits November 8, 2026 02:56
…o-skip hidden from Pass holders) (plxnative#1246)

* Settings: a viewer's own Plex Pass grants intro and credits skipping

plex.tv lists `pass` but neither `intro-markers` nor `credits-markers`
for an account with an active Plex Pass (a webOS 10 set, 2026-11-05),
so both auto-skip settings stayed hidden from a Pass holder. The feature
list is read with the viewer's own credential, so `pass` there is the
viewer's subscription and now grants both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KBgjCe8KH6Nnp3K51Fybrv

* Docs: say pass is the one subscription signal accepted, without claiming whose Pass it is

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KBgjCe8KH6Nnp3K51Fybrv

---------

Co-authored-by: Claude <[email protected]>
With Force Direct Play the automatic choice no longer swaps a 4K first copy
for a 1080p one, in build_stream and in the detail-cache check alike, so the
Forced gate tries the original file. The cache check now runs after the retry
is applied, so a retry that changes the Direct Play mode is honoured there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
When the worker swaps the first version for another, quality_policy,
src_measure and the transport fallbacks read that version's own bitrate
instead of env.src_kbps, which describes the first version (or is 0 on a
detail-cache miss). The cache check no longer sets the rate itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
RetryContext and the carried selection now record the Part their stream ids
belong to. apply_retry keeps the selection it replaces, and build_stream
restores it when the resolved Part differs, so the new Part's tracks are chosen
by the ordinary rules instead of sending the old Part's ids. Ids of an unknown
Part (0) are kept as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
…ectly

When no version is within the decoder's bound the choice keeps the smallest
one, which is transcoded too, so the line now says which version plays instead
of saying it can play directly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
Copilot AI lite review requested due to automatic review settings November 8, 2026 00:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copy link
Copy Markdown
Collaborator

The checks are green on 7561145, and CI produced a debug IPK for this PR. Could you try that build on the 32LQ63006LA before we merge? With Plex listing the 4K copy first, please use normal Play and confirm the 1080p copy direct plays. A short log excerpt showing the selected mediaIndex and the direct-play route would be enough.

GLinnik21 and others added 2 commits November 8, 2026 04:29
… uses (plxnative#1277)

The Nightly run of 2026-11-06 published its release, but the site job failed at
`subset-site-fonts.py check`: the Vietnamese press headline added to the Featured in strip (plxnative#1252)
uses ư, ấ, ầ, ậ, ẵ, ố, ộ, ụ, ứ and ử, which BASE_RANGES did not hold. The Pages build stopped
before the deploy, so nightly/latest.json and the nightly Homebrew Channel repository have not
moved since the 2026-11-05 nightly.

BASE_RANGES now holds U+01A0-01A1, U+01AF-01B0 and U+1EA0-1EF9 (the whole Vietnamese set, so the
next headline in this language needs no re-cut). Both Inter faces carry all of them. A local
subset plus check over site/ passes (22.3 KB and 22.8 KB WOFF2, up from 20.7 and 21.4).


Claude-Session: https://claude.ai/code/session_01QcMoTSpKTbjsKWecSkgvHf

Co-authored-by: Claude <[email protected]>
…i, feed or none (P7) (plxnative#1276)

The URI and Feed backends are two crates since the two PRs before this one; this makes the build say which of them a binary
contains. PLAYBACK_BACKENDS (both, the default; uri; feed; none) selects the backend features, the native sources (no
src/starfish.c without Feed), the link libraries (no libplayerAPIs/libpf without Feed) and a per-value Cargo target directory, and
every build now names its features explicitly, so the package stamp carries them. none is refused at parse time for every goal but
check-nodef, clean and the side-effect-free queries, before the stamp reset; release-guard refuses a single-backend build for the
stable and nightly ids.

ci/check-elf.sh grades a uri binary against the new ci/expected-dt-needed-uri.txt (13 entries) and fails on the Feed interposer;
ci/check-package.py decodes the stamp against the Makefile's own flag strings; CI type-checks uri, feed and none with check-nodef
and still builds and packages only both. binary_bytes rises from 18,750,000 to 20,000,000 (owner-approved) with the baseline
re-taken at 17,570,496 bytes. docs/measurements/backend-removal-drill-2026-11-06.md records the drill that deleted each backend in
turn and kept the survivor green, and docs/uri-first-migration.md is the staged-migration note it belongs to.

The shipping binary is unchanged: the RELEASE=1 build is the same size as main's and identical byte for byte once the embedded
commit and build id are masked. No Rust or C source changed. This is the last PR of the URI-first series; main now holds the whole
integration branch.

Related: plxnative#1064

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PilaScat

PilaScat commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I merged main into the branch (c46b33c) and addressed the three threads in 264163c, c36adad and 4cfe7ed, one commit each. Each regression test failed before its fix. 7561145 also rewords the version log line, which claimed the replacement plays directly even when it is only the smallest version.

On 7561145, make check passes (43 suites, 25502 passed, 0 failed, 198 ignored), make check-nodef is clean, and the armv7 cargo check of plx_data and plx_media passes.

Dolby Vision-aware selection and the detail page's hint stay as follow-ups, as you suggested.

For the 32LQ63006LA: I'll install the debug IPK from this PR's CI, start a film whose 4K copy is listed first with normal Play, and post the log excerpt here, with the selected mediaIndex and the direct-play route. It needs someone at the set, so I'll post it as soon as that's arranged.

@PilaScat

PilaScat commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Tested on the 32LQ63006LA (webOS TV Lite 7.6.0, k8ap) with the debug IPK from 7561145, on a remote connection, with a profile that prefers Italian audio.

The version choice works. With the 4K copy listed first, normal Play and Resume both pick the 1080p copy, and the ceiling reads its rate:

route: the first version cannot play directly; playing version 20052 (mediaIndex 1) instead
decision: part=directplay video= general=None mde=Some(1000) -> DIRECT PLAY
route: Auto adaptive — source 2535kbps 1920x800; starting 720kbps HLS (Some(ProbeInconclusive))

With the quality set to Original, the same play becomes decision output: v=hevc a=opus, with the 1080p video copied.

Nothing actually started on this set, though, and that isn't this PR. A film with a single 1080p version stops the same way, and so does today's nightly (1d96fbb), which doesn't have this PR:

devcaps: gstcool dropped=["aac", "ac3", "eac3", "dts"] kept-unlisted=["opus"]
decision output: v=h264 a=opus
start_bufferfeed: no Opus layout for 0 channel(s); refusing the Load

That's #1096. I've added this set's gstcool.conf there for #1133. Until a fix for it lands, I can't show you a direct play on this TV: with AAC, AC3 and E-AC3 dropped, every Italian track gets converted. Once it's in, I'll repeat the test and post the result here.

…ative#1133)

Some webOS devices list AAC, AC3 and E-AC3 in the codec table but only list disabled software decoders in gstcool.conf. Preserve those baseline codecs so Plex can play the advertised tracks without converting them. Keep the existing DTS guard for sets that advertise DTS without a working decoder.

When Plex converts a different codec to Opus, give the Feed Load a channel count bounded by the transcode profile instead of zero. Use the same layout limit in track admission and in the Opus header builder.

Refs plxnative#1096.

Verified by CI and on the dev LG with the packaged debug build: H.264 1080p with AC3 5.1, all pipeline assertions passed.

Co-authored-by: Heiko Kopp <[email protected]>
Copilot AI lite review requested due to automatic review settings November 8, 2026 17:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copy link
Copy Markdown
Collaborator

The audio fix from #1133 is now in main, and I updated this PR so the new debug IPK for e0c0406 contains both fixes. Could you repeat the test on the 32LQ63006LA with the same film and Italian audio preference? Please use normal Play with Plex listing 4K first, at Original quality for comparison with your earlier run. A short log showing mediaIndex=1, the final playback route, and whether picture and sound actually start would be enough. Thanks for testing this on the set!

@PilaScat

PilaScat commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

I repeated the test on the 32LQ63006LA with the debug IPK from e0c0406, under the same conditions as before:

  • the same film: 4K HEVC listed first, then a 1080p HEVC 1920x800 copy, both with Italian AC3 5.1;
  • the same Italian audio preference;
  • Original quality;
  • normal Play from the film's page (Resume, as in the earlier run);
  • a remote connection.

It starts, as a direct play of the 1080p copy:

devcaps: gstcool dropped=["dts"] kept-unlisted=["opus"]
route: the first version cannot play directly; playing version 20052 (mediaIndex 1) instead
route: account prefers audio it — playing that track
decision: part=directplay video= general=None mde=Some(1000) -> DIRECT PLAY
load: v=H265 a="AC3" fps=23.976 dv=present:0 P0/0 el:0 atmos:0 max=1920x1080@60
stream: https://<host> path=/library/parts/37332/…/file.mkv?…
smp_cb type=17 num=0 str={…"resourceList":[{"type":"VDEC","portNumber":2},{"type":"ADEC","portNumber":1}]}
timeline playing t=839s/10464s
timeline playing t=851s/10464s

Frames were displayed throughout (sink: displayed). The set was muted for the test, so for sound I can only show the pipeline: the ADEC port was granted, and AC3 frames kept being fed for the whole run (feed a#1800 … fed=57571000000). On the server, all six part requests from the TV were for part 37332, the 1080p copy, with 206 ranges. None went to the 4K part, and the session had no transcode.

One thing I noticed: Plex's dashboard shows that session as the 4K media (34027), because the timeline carries only the ratingKey. It's cosmetic, but Tautulli logs it as 4K too. I can open an issue for it if you think it's worth one.

@GLinnik21 GLinnik21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three review fixes and their regression tests check out. CI is green on this head, and the 32LQ63006LA retest confirms that Play selects the 1080p copy and runs it directly with AC3 frames fed throughout. The dashboard and Tautulli media attribution can be tracked separately.

Copilot AI lite review requested due to automatic review settings November 8, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@GLinnik21 GLinnik21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final URI regression fix is in 15ef2023. The new tests preserve a qualified first copy and cover falling back to the Feed-compatible version when URI qualification is unavailable. CI is green on this head. The LG retest covered the ordinary Feed path with the audio fix and confirmed direct playback of the 1080p copy.

@GLinnik21
GLinnik21 merged commit 6131d5c into plxnative:main Nov 8, 2026
14 checks passed

Copy link
Copy Markdown
Collaborator

Merged into main as 6131d5c. Thanks, Filippo, for the fix, the regression tests, and the follow-up logs from the 32LQ63006LA. The part requests made it clear that the TV was playing the 1080p copy even though the dashboard showed 4K. A separate issue for the dashboard and Tautulli attribution would be useful.

@PilaScat

PilaScat commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for merging! A correction before anyone opens that issue: Plex recorded this session correctly, so there's nothing to track. The server's decision was media 20052, part 37332, direct play, and Tautulli logged the session as 1080p, 2535 kbps, direct play, AC3. The 4K I reported came from my own capture, which read only the first Media element of the session. Plex lists every version there and marks the one playing as selected.

@PilaScat

Copy link
Copy Markdown
Contributor Author

Three follow-ups from this PR that I'd like to pick up, with what I found on main (f8f6dbb). The detail page has its own issue (#1327).

  1. A version picked by hand is measured at 0 kbps. request_env clears src_kbps for a picked version, saying "a picked one is measured from its own fetch" (media/src/route/decision.rs:10322). But build_stream takes the fetched item's bitrate only for the automatic choice (media/src/route/plan.rs:1878: (None, Some(_)) => … p.bitrate, otherwise env.src_kbps). So Play Version starts Auto with no source bitrate. Fix: take plan.playing's bitrate whenever a version was fetched, picked or automatic. One line, plus a test.
  2. The default version and a replaced one are measured differently. Media[0] goes through source_kbps, which prefers the video stream's bitrate. A replaced version uses PlayingItem::bitrate, the whole file, which is what that field's doc says Auto should use for headroom. Which one do you want for both?
  3. The version choice ignores Dolby Vision. decodable_version passes DvPresentation::NotDv for every version (plan.rs:4259). On a set without DV, a Profile 5 copy therefore counts as direct-playable and can be picked over an HDR10 or SDR one listed after it. Fix: carry each version's DV layering in MediaVersion from the item's video stream, and pass it through.

Do you want these as one PR or three? I'd start with 1.

@GLinnik21

Copy link
Copy Markdown
Collaborator

Better separate

nphil added a commit to nphil/Marquee that referenced this pull request Nov 18, 2026
Play starts a version the TV can decode when the first one listed is one it cannot (a codec the set lacks, a resolution above it, or a Dolby Vision Profile 5 copy when the set shows none), instead of leaving the server to convert it. Forced Direct Play still tries the first copy.

A substituted default and a version picked by hand are measured from the fetch that names them, and the quality limit judges every version on its own video bitrate, as the first copy always was. A retry that moves to another file keeps its audio and subtitle choice only while it stays on the same file.

Ported from upstream 6131d5c (Default to a playback version the TV can decode (plxnative#1245)).
Ported from upstream 301811e (Version choice: measure a version picked by hand from its own fetch (plxnative#1333)).
Ported from upstream a056817 (Version choice: judge each version's Dolby Vision as the direct-play gate does (plxnative#1421)).
Ported from upstream 3878e4f (Quality ceiling: judge every version on its video bitrate, as Media[0] is (plxnative#1423)).
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.

5 participants