marfritmerged 1 commits from claude-noether/libva-v4l2-request-fourier:noether/h264-3-set-controls-bitstream-bug-8 into master2026-05-20 18:19:03 +00:00
Closes the libva-side portion of marfrit/libva-v4l2-request-fourier#8.
Two small additions to h264_set_controls:
1. When VAPicture->num_ref_frames is 0 (older ffmpeg-vaapi paths /
some daedalus_v4l2 consumers), count valid (non-INVALID) DPB
entries in ReferenceFrames[16]. If even that returns 0, fall back
to a per-profile spec minimum (1 for baseline, 4 for main/high).
Hardware decoders (rkvdec, hantro, rpi-hevc-dec) tolerated the
prior 0; libavcodec-via-daedalus enforces sps.max_num_ref_frames
strictly and rejected every frame.
2. One request_log line at function entry dumping the raw VAAPI
fields (seq_fields.value, pic_fields.value, num_ref_frames,
bit_depth_*, picture_*_in_mbs_minus1). Disambiguates "ffmpeg-vaapi
never populated" from "daedalus_v4l2 wire protocol corrupted" for
the bit-fields-read-as-zero portion of issue #8.
Out of scope here (separate issue if pursued): profile_idc and
level_idc remain session-derived. VAAPI's VAPictureParameterBufferH264
omits both (verified higgs libva 2.22.0-3, /usr/include/va/va.h:
3571-3622) — same VAAPI-blindspot family as the HEVC SPS fields. A
real fix requires SPS-NAL parsing from surface->source_data OR a
daedalus wire-protocol pass-through; both are operator design calls,
not a libva-only patch.
Build verified on higgs (Debian 13 trixie, gcc 14.2.0, libva 2.22.0):
clean ninja link of v4l2_request_drv_video.so, vainfo enumerates all
8 codec profiles, no init regression.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>