Skip to content

Quality ceiling: judge every version on its video bitrate, as Media[0] is - #1423

Merged
GLinnik21 merged 2 commits into
plxnative:mainfrom
PilaScat:fix/version-ceiling-video-bitrate
Nov 17, 2026
Merged

GLinnik21 merged 2 commits into
plxnative:mainfrom
PilaScat:fix/version-ceiling-video-bitrate

Conversation

@PilaScat

Copy link
Copy Markdown
Contributor

Follow-up 2 from #1245 (comment), as a separate PR. It follows the rule plan::source_kbps already documents: a rung ships as maxVideoBitrate, so the source is judged on its video stream's bitrate, with the whole file as the fallback.

Before, only Media[0] on the Standard path got that rule:

  • Play. A fetched version, picked by hand or substituted for one the set can't decode, set src_kbps from PlayingItem::bitrate, the whole file.
  • URI preflight. quality_allows_original and src_measure took the whole file for every version, Media[0] included.
  • Facts row. The preview gave quality_policy the whole-file file.kbps, for Media[0] too.

For example, take a 1080p file with 7.9 Mbps of video and a 640 kbps track, under "1080p · 8 Mbps". As Media[0] it direct-played (7900 ≤ 8000), as a substituted version it was re-encoded (8540 > 8000), and the page said it converts in both cases.

  • MediaVersion::video_kbps and PlayingItem::video_kbps hold the first video stream's bitrate, 0 when the server sent none. cached_playing takes it from Detail::video.
  • plan::ceiling_kbps(video, whole) is the one rule, and source_kbps uses it. A fetched version's src_kbps, the URI preflight's quality check and src_measure, and the preview's quality_policy input go through it. Transport keeps the whole file, as PlayingItem::bitrate's doc says: source_transport_kbps, the URI request's source_kbps, transport_kbps and part_kbps.
  • The ResolveEnv::src_kbps and cur_transport_kbps docs now describe that figure.
  • MediaVersion is recorded inside Detail, so the field is serde(default, skip_serializing_if = "crate::metadata::is_zero"), now pub(crate).

Two commits:

  • fb78260: the data. Test each_version_and_the_playing_item_carry_their_own_video_bitrate. The PlayingItem literals in the tests of plx_media, plx_screens and the app take video_kbps: 0.
  • be90e05: the ceiling. Tests in decision_version_tests: a_fixed_quality_judges_the_substituted_version_on_its_video_bitrate and a_version_picked_by_hand_is_judged_on_its_video_bitrate, with a 4K version first and the 1080p file above second, and a_fixed_quality_qualifies_a_uri_original_on_its_video_bitrate. Preview test the_preview_judges_a_quality_rung_on_the_video_bitrate_play_judges, for Media[0] and for a substituted version. With the whole-file figures back, all four fail.

Based on main after #1421, so it builds on MediaVersion::dovi and the show page's on-deck versions from the episode's full read.

Checks

On be90e05, WSL2 x86_64:

  • make check: clean in 497 s. Every test result: line in the log is ok: 22472 passed, 0 failed, 239 ignored. Python: all 140 steps ok.
  • An earlier run, before the rebase, stopped on tools/tv-lock.sh selftest: three run_bounded cases found a sleep PID still alive while other steps ran beside it. Alone it passed three times out of three, and this branch touches nothing under tools/.
  • make check-nodef: clean.
  • cargo check --lib --target armv7-unknown-linux-gnueabi -p plx_data -p plx_media -p plx_screens: clean.
  • fb78260 alone: cargo check --tests --workspace is clean and its plx_data tests pass.
  • pr-reviewer: three MINOR. The URI preflight still judged the whole file: fixed in be90e05, with its test. The show page's on-deck versions: covered by Version choice: judge each version's Dolby Vision as the direct-play gate does #1421, which this branch is based on. Two stale docs: fixed. doc-claim-auditor: the ResolveEnv::src_kbps and cur_transport_kbps docs, fixed.

Not covered

  • No television run.

🤖 Generated with Claude Code

PilaScat and others added 2 commits November 17, 2026 11:29
…bitrate

`MediaVersion::video_kbps` and `PlayingItem::video_kbps` hold the first video
stream's own bitrate, 0 when the server sent none; `kbps` and `bitrate` stay
the whole file's. The cached playing item takes it from the detail's video
stream. The version field is serialized only when set, so recorded details
round-trip unchanged. The test literals of `PlayingItem` in plx_media,
plx_screens and the app gain the field.

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

`source_kbps` judges Media[0] against a rung on its video stream's bitrate,
because the rung ships as `maxVideoBitrate`. A fetched version (picked by
hand, or substituted for one the set cannot decode) was judged on its whole
file instead, and so was every version on the facts row and in the URI
preflight's quality check. All three now go through `ceiling_kbps`, the video
bitrate with the whole file as fallback, and so does `src_measure`. Transport
headroom, the URI request's source rate and `transport_kbps` keep the whole
file. The `ResolveEnv::src_kbps` and `cur_transport_kbps` docs say so.

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 17, 2026 10:43

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.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Copy link
Copy Markdown
Collaborator

Thank you! This is a clean follow-up: one ceiling_kbps rule for every version, the URI preflight and the preview, with transport left on the whole file, and tests that fail without the fix. Merging.


Generated by Claude Code

@GLinnik21
GLinnik21 merged commit 3878e4f into plxnative:main Nov 17, 2026
13 checks passed
@PilaScat
PilaScat deleted the fix/version-ceiling-video-bitrate branch November 17, 2026 19:36
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)).
nphil added a commit to nphil/Marquee that referenced this pull request Nov 18, 2026
The resolution badge, facts row and HDR warning read the first version
listed even when Play starts another one. They now read the file Play
starts, with its own Dolby Vision, bitrate and audio. On a show page that
is the episode Play starts (the one being resumed, else the first one
shown), whose streams and versions come from its own full item; a card
launch picks the same episode.

Ported from upstream aa0407f (Detail: the facts row and the badge describe the version Play starts (plxnative#1379)).
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)).
Ported from upstream 247aa86 (Share the video facts of the file Play starts (plxnative#1457)).
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.

3 participants