Skip to content

Version choice: measure a version picked by hand from its own fetch - #1333

Merged
GLinnik21 merged 3 commits into
plxnative:mainfrom
PilaScat:fix/picked-version-bitrate
Nov 11, 2026
Merged

GLinnik21 merged 3 commits into
plxnative:mainfrom
PilaScat:fix/picked-version-bitrate

Conversation

@PilaScat

Copy link
Copy Markdown
Contributor

Follow-up 1 from my comment on #1245.

request_env clears src_kbps for a picked version, since that value describes the default one, and says the pick "is measured from its own fetch" (media/src/route/decision.rs:10322). But build_stream took the fetched item's bitrate only for the automatic choice (media/src/route/plan.rs:1878), so Play Version started with src_kbps 0. Zero fails closed: with a quality rung selected, the play went to the re-encode even when the picked version fits the rung.

Three commits:

  • c009595: every fetched version takes its PlayingItem::bitrate. Test: a_version_picked_by_hand_is_measured_from_its_own_fetch picks the 1080p copy of a 4K-first item at 1080p quality and expects src_measure == (2372, 1920, 800). Before the fix it got (0, 1920, 800).
  • ab59489: a picked version that is gone from the item plays the default, which is now measured from its own fetch instead of the 0 request_env left. Test: a_picked_version_that_is_gone_is_measured_from_the_default_that_plays expects 14663 kbps; before, 0.
  • c56d509: two existing comments said which version they measure too narrowly: PlayingItem::bitrate is the played version's rate, not always Media[0]'s, and cur_src.0 is the video stream's rate only for the default measured from the detail.

Checks

On c56d509, WSL2 x86_64:

  • make check: 44 suites, 26485 passed, 0 failed, 200 ignored (all 127 steps ok).
  • make check-nodef: clean.
  • cargo check --lib --target armv7-unknown-linux-gnueabi -p plx_media: clean.
  • make test-crate C=plx_media T=version_tests: 41 passed.
  • pr-reviewer: no blocker or major. Its two minor points on this diff are fixed in ab59489 and c56d509. The third is follow-up 2: a fetched version is measured on the whole file while the default from the detail prefers the video stream, so at a tight rung Play Version can re-encode a file that Play from the detail page plays directly. It fails in the conservative direction, as the automatic choice already did.

Not covered

🤖 Generated with Claude Code

PilaScat and others added 3 commits November 11, 2026 13:23
request_env clears src_kbps for a picked version, because the value
describes the default one, and says the pick is measured from its own
fetch. build_stream did that only for the automatic choice, so Play
Version started with src_kbps 0, which fails closed: with a quality rung
selected, the play routed to the re-encode even when the picked version
fits. Any fetched version now takes its PlayingItem::bitrate.

The new test picks the 1080p copy of a 4K-first item at 1080p quality and
expects (2372, 1920, 800); before the fix it got (0, 1920, 800).

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

When the version picked by hand is no longer on the item, build_stream
plays the default it fetched, but measured it with env.src_kbps, which
request_env sets to 0 for any picked version. With a quality rung
selected that fell back to the re-encode. Whenever a version was asked
for, the fetched item's bitrate is used now.

The new test asks for a version id the item does not have and expects
the default's 14663 kbps; before the fix it got 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Filippo Scatigna <[email protected]>
PlayingItem::bitrate is the whole-file rate of the version that plays,
not always Media[0]'s, and cur_src.0 is the video stream's rate only for
the default version measured from the detail: a fetched version carries
its whole-file rate. Both comments were already loose for the automatic
choice; this branch widened them to Play Version.

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 11, 2026 15:48

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 merged commit 301811e into plxnative:main Nov 11, 2026
22 of 26 checks passed
@GLinnik21

Copy link
Copy Markdown
Collaborator

Thank you! Merged, it'll go out with the release.

@PilaScat
PilaScat deleted the fix/picked-version-bitrate branch November 12, 2026 00:54
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.

3 participants