Repository navigation
Measure a file before deciding how to play it - #306
Merged
Merged
Conversation
From a5's review of #304: an unprobed HEVC .mp4 was still reported direct-playable and would fail on-device until the hourly backfill reached it. Judging an unmeasured file on its container alone is optimistic in the one direction that hurts. StreamPolicy::decide() now probes a video nobody has measured and decides on its codecs. ffprobe reads a header, not a file, and it happens once. Failure is quiet: no ffprobe or an unreadable file leaves the item unmeasured and the decision falls back to the container, exactly as before. a5 also asked whether every decision path eager-loads probe. Two did not: WatchController gates the web player on isPlayableVideo(), so an HEVC mp4 passed and loaded a black rectangle; and needsConversion() decides whether to queue a conversion, so an optimistic answer meant none was queued for the files that needed one. Both load it now. The first two tests encode real HEVC and H.264 and drive the endpoint, because the point is what gets measured -- a fixture would assert the plumbing while the behaviour stayed wrong.
Owner
Author
|
Reviewed on a5 — clean. 3 tests pass (real HEVC/H.264 encodes driving the endpoint — the right way to test this, since a fixture would assert the plumbing while the behaviour stayed wrong). Based on current main, no migration, no file ops (probe reads headers, writes a DB row). Both points from #304 handled well:
Nothing blocking. Stacks logically after #305 (both from main, independent). The playability chain (#304/#305/#306) now decides on real codecs, transcodes to an Apple-safe profile, and measures on demand — that's the Avatar/Midnight Gospel class of bug closed server-side. |
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.
Both non-blocking points from your #304 review, acted on. One of them turned out to be hiding two real bugs.
1. The unprobed window — probe on demand
You wrote that an unprobed HEVC
.mp4is still reported direct-playable and fails on-device until the backfill reaches it. Agreed, and the user chose to close it rather than wait:StreamPolicy::decide()now measures a video nobody has measured, then decides on codecs.ffprobe reads a header rather than a file, so it is cheap on the path, and it happens once — the row is written and every later decision reads it. No needless transcodes, no wrong answers.
Failure is deliberately quiet: no ffprobe, a file on another machine, a format it refuses — the item stays unmeasured and the decision falls back to the container, exactly as before. A playback request must not fail because a measurement did.
2. "Worth confirming the actual decision path eager-loads probe"
I audited every caller of
isPlayableVideo(). Two were deciding blind:WatchController:35gates the web player on it. An.mp4of HEVC passed the gate and loaded a player showing a black rectangle — the same failure, on the web.MediaTranscoder::needsConversion()decides whether to queue a conversion. An optimistic answer meant no conversion was ever queued for precisely the files that needed one.The second is the more interesting: it is self-reinforcing. The file is called playable, so nothing converts it, so it stays unplayable. Both now
loadMissing('probe').So your question found a bug neither of us was looking for. Thank you for it.
Testing
3 new tests, 369 pass. The first two encode real HEVC and H.264 files and drive the actual endpoint — the point is what gets measured, and a fixture would have asserted the plumbing while the behaviour stayed wrong. Confirmed to fail without the change (2 of 3 fail, with "The decision path should have probed a file nobody had measured").
The third covers a file that cannot be measured at all, which must still return a decision.
Note
This stacks on #305 (H.264 profile pinning), which is open and unreviewed — that one fixes a different black-video cause found since: a 10-bit source came out of the HLS transcode as High 10, which Apple hardware refuses. Worth reviewing that one first; this branch is from main and does not depend on it.