Repository navigation
Preview: an Auto trailer whose remote preflight gets no response plays the Original - #1430
Merged
Merged
Conversation
The detail page's preview only ever plays a direct play. With quality Auto
and a remote server, build_stream still ran Auto's remote Original
preflight for it, which can only turn a playable trailer into a refusal:
a Plex extra redirects twice to an external CDN, the preflight's setup
budget (about a second for a 5000 kbps source) ran out on those hops, no
capacity sample came back, Auto chose HLS and the preview gate refused it
("preview: refused - not a direct play (adaptive)").
A preview whose quality is Auto now plans as Original, the way a forced
direct play already does, through the planner's own ResolveEnv.preview
fact: no preflight GET, no Auto decision, one event-log line saying why.
A fixed rung is untouched, as is every non-preview play on Auto. The
now-unreachable preview_already_refused guard goes, and the comments that
named Auto's HLS as a preview refusal are corrected.
Closes #1425
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The first fix planned every Auto preview as Original, skipping the remote preflight. A local trailer the PMS serves at any bitrate over a slow link then direct-played at link capacity with nothing to rescue it (a preview's Original is never watched, and a Load that fails before a picture arms the preview breaker), where main refused it on the preflight's slow sample. Keep the preflight and the Auto decision for a preview. Type the preflight's outcome (RemoteProbe: Sample, NoResponse, Unmeasured) and plan the preview as Original only on NoResponse: an open that failed in the network (Transport or the setup deadline), so nothing was measured. Any sample, even an incomplete one, still decides as on main, and so does a server's own refusal of the Part. Full plays are unchanged. The preview guard, the Adaptive refusal path and their comments are main's again, and the URI qualifier reads the quality the planner settled on. Closes #1425 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1425
What
I made the detail page's trailer preview plan as Original (a direct play) when, on Auto with a remote server, Auto's remote Original preflight gets no response at all: its open failed in the network, so nothing was measured. The preflight still runs for a preview, and any sample of the link still decides as before, so a link too slow for the file still refuses the preview, as on
main. Full plays, fixed rungs and quality Original are unchanged.The route says why, beside the existing
auto:/route:lines. The existingauto: remote Original preflight produced no capacity sample failure=Open(Transport(28)); using HLSline is still printed first, and its "using HLS" no longer holds for a preview, so the next line says what happened:Why
A preview is direct play or nothing (
preview: refused — not a direct play, the preview gate inplan.rs). For a Plex extra at/services/iva/assets/…/video.mp4the preflight's open can fail withOpen(Transport(28))after the two cross-origin redirects in the report. There is then no sample,abr::bootstrapdenies withProbeInconclusive, Auto chooses HLS, and the preview gate refuses it. A refusal that rests on no evidence about the link is the only outcome Auto could give a preview. Which phase of the open hit rc=28 is not known (the report has no timings). The probe's budget for a 5000 kbps source is 1000 ms for setup and 1000 ms for the body (abr/original.rs:21,decision.rs:9472), which is consistent with it, not proven.I first planned every Auto preview as Original and dropped the preflight. Review showed that goes too far: a trailer can also be a local file the PMS serves from
/library/parts/at any bitrate, and over a slow link a skipped preflight direct-plays it at link capacity with nothing to rescue it (auto_original_watchedis false for a preview, and a Load that fails before the first picture arms the preview breaker inplayer/preview.rs). So the preflight stays, and only its empty answer is read differently.The change:
decision.rs:measure_remote_originalreturns a typedRemoteProbe(decision.rs:9505) instead of anOption:Sample(CapacityObservation): the server answered and bytes were read, however few (the sample's owncompletedsays whether the target was reached).NoResponse: the open failed in the network,OpenErr::Transport(_)orOpenErr::Deadline(DNS, TLS, connect, a timeout, or the setup deadline before the first header).Unmeasured: everything else (no source bitrate, a status or range refusal from the server, local machinery failing, a transfer that failed after it had opened)..sample(), so full plays and the remux probe read exactly what they read before.plan.rs: the Auto arm records whether a direct-play preflight came backNoResponse(plan.rs:2681). A preview with that outcome counts asauto_original(plan.rs:2753), so there is no HLS override and the gate sees a plain direct play. For any other outcome the code ismain's again:preview_already_refused, theadaptiveoverride and thePreviewRefusal::Adaptivepath are reachable as before, and their comments aremain's.plan.rs:2067: the URI qualifier's private copy of the Force Direct Play quality mapping now readsplayback_quality, the quality the planner settled on. The value is the same as before (the planner no longer changes the quality for a preview); it just stops being a second copy that could drift. The qualifier runs before the preflight, so it cannot see aNoResponseresult; the URI engine declines a preview anyway.Behaviour changes to know about, all for a Remote Auto preview:
adaptive, now direct plays (the Auto, remote: the detail page's trailer is refused because the Original preflight times out on its CDN redirect #1425 case).route: Auto Original …line a play gets (unchanged frommain).adaptive.Tests
All in
rust-modules/media/src/route/plan_audio_enhancement_tests.rs, on the existing loopback-PMS resolve rig (which records every request line). I added aPartAnswer::Hanguptodecision_test_support.rs: the Part GET is closed with no response, which curl reports as a transport failure of the open (Open(Transport(52))), the shape of the report'sTransport(28).a_preview_on_auto_whose_preflight_gets_no_response_direct_plays_the_originalasserts a Part URL, no verdict, no HLS contract, no watch, the preflight GET still on the wire, theno capacity sample failure=Open(Transport(line, oneroute: Auto previewline and noroute: Auto adaptive. It also checks the plan has the same contract and Part path as a preview under Original, which makes no Part GET.a_preview_on_auto_whose_preflight_measures_a_slow_link_is_still_refused: anOksample withtarget_reachedfalse (a 100 KB body for a 6 MB target) is refused asadaptive, the same verdict as onmain, withroute: Auto adaptiveand noroute: Auto preview.a_preview_on_auto_whose_part_the_server_refuses_is_still_refused: a 503 on the Part GET is refused asadaptive.the_same_item_played_in_full_on_auto_still_starts_hls_when_the_preflight_gets_no_response(control): the same failing open withpreviewoff makes the Part GET and starts aFixedHlsplan.a_preview_under_original_is_unchanged: direct play, no Part GET, progressive contract, no ceiling, noroute: Autoline.a_direct_playable_preview_that_auto_sends_to_hls_is_refused_as_adaptiveanda_transcoded_preview_under_auto_is_not_direct_even_though_auto_also_chose_hlsaremain's, untouched.Red on
origin/main. Withmain'splan.rsanddecision.rsand only the test files added (PartAnswer::Hangupand the new tests),make test-crate C=plx_media T=plan_audio_enhancement_tests:Only test 1 is red. Tests 2 to 5 pass on
mainand with the fix, because they pin what must not change. With the fix:test result: ok. 49 passed; 0 failed; 0 ignored; 0 measured; 2207 filtered out; finished in 0.64s.Gates, on the committed tree (
git status --shortempty before and after each):Not verified
Hangupis a stand-in for the report'sTransport(28), not the same errno.pr-reviewerpass ran on the first version; its MAJOR (a local trailer over a slow link) is why this version is narrow. Not run: the fullmake checkand the ARM cross-build (CI runs both), anddoc-claim-auditor. No release-note line added.Not changed: a full play of the same trailer on Auto remote
A full play (Play Trailer,
Action::PlayTrailer→request_playwithpreview: false) goes through the same(Quality::Auto, Some(Remote))arm and the same preflight. If the 1 s probe gets no response, the trailer starts as Auto-adaptive HLS at the 480p-class fallback rung (720 kbps in the report). It is not refused, only degraded. This is from reading the code, not a run. This PR leaves it as it is; it is the owner's call.bootstrapturns a completed sample into the starting rung and a weak prior for the live estimator, and an incomplete one into the 480p fallback.ResolveEnv::omit_queue_continuousderives fromExtraContext::of(ctx), but the redirect itself is only known once the open is made) and plan it as Original without the PMS preflight, relying on the existing Original-to-HLS rescue (a full play isauto_original_watched) if the CDN stalls; or, narrower, apply this PR's rule to full plays: only aNoResponsepreflight plays the Original, and a measured slow sample still goes to HLS. A full play has the rescue, so that would be safer there than it is for a preview. The cost of either is that a slow CDN is found by a stall instead of by a one-second probe. Leaving it alone is also defensible: Auto's "HLS when unsure" is deliberate and the play still starts.rc=28.🤖 Generated with Claude Code