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:
+19
-5
@@ -1,13 +1,27 @@
|
||||
# Project Memory — screen_cast
|
||||
|
||||
Last updated: Phase 3 validated and complete; current phase is Phase 4.
|
||||
Last updated: Phase 4 (RTP framing) complete and tested; current phase is
|
||||
Phase 5.
|
||||
|
||||
## Project state
|
||||
|
||||
- **Phase 3 is done and validated on the desktop**: a manual
|
||||
`./build/tools/capture_smoke 10 out.h264` run on Wayland/Hyprland produced
|
||||
a valid 2256x1504 H.264 elementary stream (ffprobe clean). `docs/PHASES.md`
|
||||
is ticked; current phase is Phase 4 — RTP framing.
|
||||
- Phase 4 done: `sc_network` library implements `RtpHeader`/`RtpPacket`
|
||||
(RFC 3550 serialize/parse; tolerates CSRC lists, extension headers, and
|
||||
padding on the receive side) plus `H264Packetizer`/`H264Depacketizer`
|
||||
(RFC 6184 single-NAL + FU-A; STAP-A never emitted, unsupported types mark
|
||||
the frame damaged on receive).
|
||||
- Depacketized access units use **3-byte start codes**, and the splitter
|
||||
keeps a zero byte preceding a start code with the previous NAL, so both
|
||||
3- and 4-byte-start-code streams round-trip byte-exactly (tested).
|
||||
- Loss handling is drop-on-damage: a sequence gap or missing FU fragment
|
||||
marks the frame damaged and it is dropped silently at its marker. Full
|
||||
loss recovery / jitter handling is Phase 7.
|
||||
- `test_rtp` covers header/packet round-trips, malformed rejections, NAL
|
||||
splitting (3- and 4-byte codes), FU-A chunking with MTU bounds, full
|
||||
packetize→depacketize round-trip, gap dropping, frame separation by
|
||||
marker alone, sequence wrap, and random default SSRC/sequence.
|
||||
Valgrind-clean; `meson test` 3/3.
|
||||
- Phase 3 remains validated; earlier review fixes still in place.
|
||||
- The first smoke run emitted `impl_ext_end_proxy called from wrong context`
|
||||
warnings: `pw_context_connect_fd` and `pw_core_disconnect` ran outside the
|
||||
thread-loop lock. Fixed by holding the lock across all pw setup/teardown
|
||||
|
||||
Reference in New Issue
Block a user