Skip to content

Refuse 10-bit video for direct play - #307

Merged
tripsittr merged 1 commit into
mainfrom
reject-ten-bit
Oct 6, 2026
Merged

tripsittr merged 1 commit into
mainfrom
reject-ten-bit

Conversation

@tripsittr

Copy link
Copy Markdown
Owner

Follow-on from your #305 review. You noted the Midnight Gospel episodes are 10-bit HEVC Main 10 — which prompted me to check whether 10-bit reaches the same failure by a route #305 does not cover. It does.

The gap

A 10-bit H.264 .mp4 needs no transcode to fail. The stream is genuinely h264, in a genuinely .mp4, so the container check passes and the codec check passes — and the file is handed over untouched as High 10, playing black.

bit_depth has been recorded by the probe all along. Nothing consulted it.

So #305 fixed the case where we produce High 10; this fixes the case where the file already is High 10 and we pass it through.

Verified against a real encode

codec_name=h264   profile=High 10   pix_fmt=yuv420p10le   bits_per_raw_sample=10

Before: bit_depth=10 and isPlayableVideo=true. After: refused, so it routes to the transcode that now produces 8-bit High.

One judgement call

An unrecorded depth is treated as 8-bit. That is overwhelmingly what it is, and assuming otherwise would transcode every file an older probe measured for a rare case. The cost of being wrong here is one file that plays black until re-probed; the cost of the opposite is transcoding a library that did not need it.

Testing

3 new tests, 385 pass. Confirmed to fail without the check. The real 10-bit file is correctly refused.

Rebased onto main after #306 merged.

#305 fixed the transcode side: libx264 inherited the source pixel format and
emitted High 10, which Apple hardware refuses. a5's review noted the Midnight
Gospel episodes are 10-bit HEVC Main 10, which prompted checking the other
route.

A 10-bit H.264 .mp4 reaches the same failure with no transcode at all. The
stream is genuinely h264 in a genuinely .mp4, so every check passed and the
file was handed over untouched as High 10, playing black. The probe had
recorded bit_depth all along and nothing consulted it.

Verified against a real encode: codec_name=h264, profile=High 10,
bits_per_raw_sample=10. Before, isPlayableVideo returned true; now it is
refused and routes to the transcode that produces 8-bit High.

An unrecorded depth is treated as 8-bit, because that is overwhelmingly what
it is -- assuming otherwise would transcode every file an older probe measured.
@tripsittr

Copy link
Copy Markdown
Owner Author

Reviewed on a5 — clean. 18 tests pass. Based on current main, no migration, no file ops.

Correct and precisely scoped: playsDirectly() now rejects (bit_depth ?? 8) > 8, so a 10-bit H.264 .mp4 — which genuinely passes the container and h264 codec checks but is High 10 and dies on Apple hardware — no longer direct-plays. Uses the bit_depth the probe already captures; null→8 keeps the optimistic-unknown default consistent with the rest of the chain (and #306's on-demand probe + the backfill populate bit_depth for anything stale).

Closes the gap my #305 note pointed at — the untranscoded route to the same 10-bit failure. Together #304 (codec) / #305 (8-bit transcode) / #306 (probe-on-demand + the two blind callers) / #307 (reject 10-bit direct) fully close the Avatar/Midnight Gospel class server-side. Nothing blocking.

@tripsittr
tripsittr merged commit 73b105a into main Oct 6, 2026
3 checks passed
@tripsittr
tripsittr deleted the reject-ten-bit branch October 6, 2026 23:07
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.

1 participant