docs(BUGS): mark #5 zero-format encoder init as fixed (b9e62d6)

This commit is contained in:
dailz
2026-05-22 15:17:39 +08:00
parent b9e62d6830
commit 573569ade7

View File

@@ -46,11 +46,12 @@
- **Fix**: Wrap the descriptor pointer in a small RAII guard that reclaims the box on every return path, or recover the box before propagating the encode error.
- **Fixed in**: [`2d448dc`](commit:2d448dc) — Moved `Box::from_raw` descriptor recovery from after `encode_frame` to before it. Since `av_hwframe_transfer_data` has already imported the DMA-BUF into the VAAPI surface by that point, the descriptor struct is safe to reclaim. Now `encode_frame`'s `?` early-return can no longer leak the descriptor.
### #5: Portal can initialize encoder with zero or unknown format
### ~~#5: Portal can initialize encoder with zero or unknown format~~ ✅ Fixed
- **Location**: `src/cap_portal.rs:306`, `src/state_portal.rs:68`
- **Description**: `format_info.get().unwrap_or((0, 0, 0, 0))` permits sending a frame with width, height, and format set to zero before format negotiation has completed. `StatePortal` treats the first frame as authoritative and creates the encoder from those dimensions.
- **Fix**: Do not emit `PwEvent::Frame` until format info is present and `spa_to_drm_fourcc` returns nonzero; otherwise requeue or drop the buffer.
- **Fixed in**: [`b9e62d6`](commit:b9e62d6) — Replaced `unwrap_or((0,0,0,0))` with `format_info.get()` `Some`/`None` check plus explicit `width/height/format == 0` guard, placed *before* `libc::dup(fd)` to avoid wasting a fd on dropped frames. Also partially fixes #15 (unsupported SPA format → drm_fourcc=0 is now rejected at source).
---