ffmpeg-v4l2-request-fourier: restore AV_CODEC_FLAG_LOW_DELAY in H.264 decoder #87
Reference in New Issue
Block a user
Delete Branch "claude-noether/marfrit-packages:noether/ffmpeg-fourier-restore-low-delay"
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?
Bug: FFmpeg 8.x dropped the H.264 decoder's
low_delaycode path —AV_CODEC_FLAG_LOW_DELAYno longer preventsh264_select_output_framefrom running the display-order DPB output queue. The daedalus-v4l2 daemon'sctx->flags |= AV_CODEC_FLAG_LOW_DELAYatdaemon/src/decoder.c:202has been a silent no-op since the SONAME 61→62 jump landed in reauktion/daedalus-v4l2 PR #16.On Firefox YouTube this re-introduced the 2-1-4-3 B-frame pair-swap that PR #12's daemon flag was supposed to prevent.
Evidence:
Fix
0006-h264-restore-low-delay.patchtoucheslibavcodec/h264_slice.c:h264_select_output_frame: early-exit whenAV_CODEC_FLAG_LOW_DELAYis set. Emit the just-decoded picture asnext_output_pic, mirror the corruption / recovery-point tracking the main path performs, skipdelayed_pic[]/ POC reorder machinery entirely.h264_field_start: suppress the SPS-drivenhas_b_frames = sps->num_reorder_framesclobber when LOW_DELAY is set. Without this the per-slicebitstream_restriction_flagre-pickup would reintroduce a nonzero reorder buffer mid-stream even after the daemon sethas_b_frames=0atavcodec_open2.Why not daemon-side
A daemon SPS-rewrite (
num_reorder_frames=0) was considered but rejected: it works only for the daemon's reconstructed SPS NAL, not for any in-band SPS the daemon dlopens libavformat to parse in other code paths. Restoring documented FFmpeg flag semantics is the smaller, more durable change and keeps the daemon interface stable.Packaging
Verify post-merge
After deploying on higgs, Firefox YouTube on an H.264 stream with B-frames (any standard YouTube codec=avc1) should play in display order — no visible 2-1-4-3 pair-swap.
Refs
ctx->flags |= AV_CODEC_FLAG_LOW_DELAYfor H.264 only — unchanged, but now actually has effect again)