RTP Packetization
Summary
The RTP packetizer takes compressed video bytes from the wavelet compressor and wraps them in RTP/UDP/IPv4/Ethernet frames for 10GbE transmission. It targets the ST 2110-22 profile (JPEG XS over RTP). The module builds complete 54-byte headers (14 Ethernet + 20 IPv4 + 8 UDP + 12 RTP), computes IPv4 header checksums, handles payload segmentation at MTU boundaries, and sets the RTP marker bit on the last packet of each video frame.
Current State
- RTL module
rtp_packetizeris complete with parameterized MTU, payload type, and SSRC. - Testbench validates 3000-byte frame segmentation into 3 packets (2x1460 + 80 bytes).
- All header layers (Ethernet, IPv4, UDP, RTP) verified byte-by-byte in simulation.
- Marker bit correctly set only on last packet of frame.
- Payload data integrity verified through full round-trip.
- Backpressure handling tested (eth_ready deassertion mid-packet).
- SDP generator produces RFC 4566 compliant SDP for stream discovery.
Key Files
- rtl/rtp_packetizer.sv - RTP/UDP/IP/Ethernet packetizer state machine
- sim/tb_rtp_packetizer.sv - Testbench: segmentation, headers, marker bit, backpressure
- sw/sdp_generator.py - SDP file generator and HTTP server for stream discovery
- scripts/validate_rtp.py - RTP packet validation tool (sequence, timing, jitter)
Technical Details
Packet Structure (54-byte header)
| Offset | Length | Layer | Contents |
|---|---|---|---|
| 0-13 | 14 | Ethernet | Dst MAC (broadcast FF:FF:FF:FF:FF:FF), Src MAC (00:11:22:33:44:55), EtherType 0x0800 |
| 14-33 | 20 | IPv4 | Version 4, IHL 5, TTL 64, Protocol 17 (UDP), computed checksum, Src 10.0.0.1, Dst 239.0.0.1 (multicast) |
| 34-41 | 8 | UDP | Src/Dst port 5004, length, checksum 0 (optional per RFC) |
| 42-53 | 12 | RTP | V=2, P=0, X=0, CC=0, M bit, PT=96, sequence number, timestamp, SSRC 0x12345678 |
| 54+ | up to 1460 | Payload | Compressed video data |
State Machine
Four states: S_IDLE (accumulate compressed bytes), S_EMIT_HDR (send 54-byte header), S_EMIT_PAYLOAD (send payload from buffer), S_DONE (increment sequence, return to idle).
Trigger conditions for emission:
- Payload buffer reaches MAX_PAYLOAD (1460 bytes for MTU=1500)
comp_frame_endasserts (flush partial buffer with marker bit)- Previously recorded
frame_end_pendingwith buffered data
IPv4 Checksum
Computed combinationally via one’s complement sum of all 16-bit words in the IP header. The function compute_ip_checksum() takes the total length as input and folds carry bits.
Parameters
| Parameter | Default | Description |
|---|---|---|
| MTU | 1500 | Maximum Ethernet payload size |
| PAYLOAD_TYPE | 96 | RTP dynamic payload type |
| SSRC | 0x12345678 | Synchronization source identifier |
SDP Generator
The Python SDP generator (sw/sdp_generator.py) produces an SDP file per RFC 4566 with ST 2110-22 and RFC 9134 attributes:
a=rtpmap:96 jxsv/90000(JPEG XS video at 90 kHz clock)a=fmtp:96 sampling=YCbCr-4:2:2; width=1920; height=1080; depth=8; exactframerate=60000/1001a=ts-refclk:ptp=IEEE1588-2008:<clock_id>:127(PTP domain 127 per ST 2059)- Can serve SDP over HTTP on port 8080
RTP Validation Tool
The validate_rtp.py script checks captured packets for: RTP header correctness (V=2, PT=96), SSRC consistency, sequence number continuity, timestamp consistency at 90 kHz, MTU compliance, frame boundary detection via marker bit, and inter-packet jitter statistics. Supports both live UDP multicast capture and GDP-framed file analysis.
Sources
- rtl/rtp_packetizer.sv
- sim/tb_rtp_packetizer.sv
- sw/sdp_generator.py
- scripts/validate_rtp.py