Daemon never recovers from AVERROR_INVALIDDATA on tiny (≤3-byte) pause-time bitstreams; Firefox falls off to SW after resume #17
Reference in New Issue
Block a user
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?
Symptom
On higgs (Pi CM5, Debian trixie, daedalus-v4l2 0.1.0+r41+g6e6dfa1 + ffmpeg-v4l2-request-fourier 2:8.1+rfourier+gb57fbbe-9), Firefox YouTube playback through libva → daedalus is real-time HW (~46 fps at 720p H.264 / avc1). As soon as the user pauses and resumes playback, the pipeline does NOT re-engage:
/dev/video0drops out of every Firefox process's/proc/<pid>/fd/listingavc1(the stream codec is still H.264; only the decode path switched)Root cause
The last entry the daemon logs before going quiet is a 3-byte bitstream:
3 bytes is below the structural minimum for any valid H.264 NAL (3-byte start code + at least 1-byte NAL header = 4 bytes minimum). This is almost certainly libva-v4l2-request-fourier flushing a pause-time sentinel into the V4L2 OUTPUT_MPLANE queue.
daedalus_decoder_run_requestreturns the negative rc straight up tochardev_client.c::handle_req_decode, which propagates it without sending a RESP_FRAME. The kernel-side V4L2 client (libva) sees the request fail; libva returns failure to Firefox; Firefox marks H.264-via-VAAPI as broken for this content-process session and routes all subsequent H.264 to libmozavcodec.Fix (proposed)
Filter degenerate bitstreams at the REQ_DECODE entry in
daemon/src/chardev_client.c:req.bitstream_len < 4(less than minimum-possible H.264 NAL), log INFO, skip thedaedalus_decoder_run_requestcall, and return RESP_FRAME with status=OK and zero pixel output.Follow-up that we intentionally skip in this issue:
libva-v4l2-request-fourier; tracked separately if reproduced after this fix.Reproduce
sudo journalctl -u daedalus-v4l2 --since "10 seconds ago" | grep -c 'decoder: OK'while playing → >0 (HW decode through daemon)bitstream=3 bytes+ AVERROR_INVALIDDATA pair shown above.Refs
daemon/src/chardev_client.c::handle_req_decode(the entry point that needs the length check)