Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoDetect H.264 RTMP keyframes from NAL headers
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1.
|
FLV carries each NAL unit behind a 4-byte length. The slices were written with their Annex-B start code still in front (all 274 in a 12 s capture); they are now written without it, as the SPS and PPS already are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Updated after the automatic review (second commit). Start code inside the FLV payload: correct, and it was so for every slice before this change too: the slices went to The second commit removes a 3- or 4-byte start code in front of the slice before it is written, in the same way the SPS and PPS setters in 🤖 Generated with Claude Code |
What was wrong
RTMP sends no video on Fullhan V200: the camera connects, sends the metadata, and then never sends the video sequence header, so the server or player gives up ("could not find codec parameters"). Seen on a Ruision F8 board (FH8856V200) with FFmpeg as the RTMP listener.
Why
rtmp_ingest_video()(src/rtmp.c) waits for a slice whose type in the pack's NAL table isNalUnitType_CodedSliceIdr(5) before it sends the sequence header. The Fullhan V200 HAL fills that table from the encoder's own stream record, and the key-frame slice does not arrive as type 5 there, so the first key frame never comes and every slice is skipped.What this changes
For H.264, the slice type is also read from the NAL header byte after the start code (
& 0x1F). A NAL counts as a slice, and as a key frame, if either the table or the header says so. H.265 is unchanged.How it was checked
./build.sh fhan-v2, no new warnings;./test.sh -apasses.Effect on other platforms
Shared code. On HALs whose table already says 5, the header says 5 as well, so nothing changes. The header is read only when the NAL starts with a 3- or 4-byte start code and is long enough.
Update after the automatic review
A second commit removes the Annex-B start code from slices before they are written to FLV, as
flv.calready does for SPS and PPS. Before, every slice carried it (274 of 274 in a 12 s capture); after, none, with all 274 frames decoded.🤖 Generated with Claude Code