Media Foundation buffers remain locked after rejected output and input lock failures are unchecked #2835
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot#2835
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The Media Foundation AV1 path in
host/mf_av1.cat51da0464b4cf0c7f56b81ebd6bb309325835e175unlocks an output buffer only when its picture reaches the callback. A successful lock followed by a rejected pointer or pitch still needs an unlock. The input path also copies through the buffer pointer without checking whetherIMFMediaBuffer::Locksucceeded, and ignores failures while setting the input length or attaching buffers to samples.Reproduction
A Windows test uses an actual
MFCreate2DMediaBufferobject and the unmodifiedpullfunction, with an authored transform returning one deliberately unsupported bottom-up RGB picture to the NV12 path. The callback correctly receives no picture, butGetScanline0AndPitchshows the buffer still locked afterpullreturns. The candidate balances that lock. This is rejected-picture cleanup, not evidence that an actual AV1 decoder returns bottom-up RGB or that it caused an observed game crash.A separate game-free regression injects HRESULT failures into the actual
pullandmf_av1_decodebodies. It covers 15 output/input scenarios, including normal 2D and linear buffers, the linear fallback, rejected pictures, failed locks, failed sample/buffer creation and failed buffer attachment. It checks lock counts, reference counts, callback geometry and copied input bytes. The candidate passes every case with Clang 23.1.5 on Windows; the base has behavioral failures. Invalid baseline copies are intercepted by the fixture rather than dereferenced.Scope
Draft #2859 makes a narrow buffer acquisition/release correction, keeping decoder selection, output format, successful-picture content, GPU policy and COM initialization policy unchanged. The delivered team-room claim names this scope; private investigation preceded it. Current open-PR file inventory found no
host/mf_av1.coverlap.No gameplay run, FPS improvement or RAM-saving magnitude is claimed. The PR will remain draft until runtime validation. This is fallback hardening with no observed gameplay symptom, not a Windows-wide improvement. Windows normally tries dav1d first; MF is used when that decoder is absent or cannot open. Linux does not compile mf_av1.c. Reach and priority are left unranked pending actual incidence; the speculative worklist row and unrelated encoding change were removed in
bc5078ac.The lock contract requires one matching unlock per successful acquisition: IMF2DBuffer::Lock2D, IMFMediaBuffer::Lock.
The outstanding runtime check must explicitly use Media Foundation, identified by HOS_VIDEO_LOG, and play the intro plus a movie through its end/drain. A normal dav1d session or the native authored RGB-buffer control does not satisfy that check.