feat(network): implement Phase 4 RTP framing with FU-A fragmentation

Add the sc_network library: RFC 3550 RtpHeader/RtpPacket serialize and
parse (the receiver tolerates CSRC lists, extension headers, and
padding by skipping/stripping them) and RFC 6184 H.264 payloading via
H264Packetizer/H264Depacketizer.

The packetizer splits Annex-B frames into NAL units (3- and 4-byte
start codes), emitting single-NAL packets or FU-A fragments within the
configured MTU, with the marker bit closing each frame and randomized
SSRC/sequence by default. The depacketizer reassembles access units
with 3-byte start codes, so both start-code widths round-trip
byte-exactly; frames damaged by sequence gaps or missing fragments
are dropped until the Phase 7 loss-recovery work.

test_rtp covers header and packet round-trips, malformed-input
rejections, splitter behavior, FU-A chunk bounds, full packetize ->
depacketize round-trip, gap dropping, marker-only frame separation,
sequence wrap, and empty inputs. meson test 3/3, valgrind clean.
This commit is contained in:
2026-09-07 10:48:17 +02:00
parent ce52f64e52
commit b5e8d7174c
9 changed files with 870 additions and 9 deletions
+4 -4
View File
@@ -44,9 +44,9 @@ H.264 bitstream.
**Goal**: packetize NAL units into RTP and depacketize them.
- Implement `RtpHeader` and `RtpPacket` serialize/parse.
- Add H.264 NAL splitting and FU-A fragmentation.
- Unit test for serialization, fragmentation, and reassembly.
- [x] Implement `RtpHeader` and `RtpPacket` serialize/parse.
- [x] Add H.264 NAL splitting and FU-A fragmentation.
- [x] Unit test for serialization, fragmentation, and reassembly.
**Validation**: unit tests cover single-NAL and fragmented packet paths.
@@ -89,4 +89,4 @@ where available.
## Current phase
Phase 4RTP Framing.
Phase 5Local UDP Sender → Receiver Loopback.