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_packetizer is 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

Technical Details

Packet Structure (54-byte header)

OffsetLengthLayerContents
0-1314EthernetDst MAC (broadcast FF:FF:FF:FF:FF:FF), Src MAC (00:11:22:33:44:55), EtherType 0x0800
14-3320IPv4Version 4, IHL 5, TTL 64, Protocol 17 (UDP), computed checksum, Src 10.0.0.1, Dst 239.0.0.1 (multicast)
34-418UDPSrc/Dst port 5004, length, checksum 0 (optional per RFC)
42-5312RTPV=2, P=0, X=0, CC=0, M bit, PT=96, sequence number, timestamp, SSRC 0x12345678
54+up to 1460PayloadCompressed 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:

  1. Payload buffer reaches MAX_PAYLOAD (1460 bytes for MTU=1500)
  2. comp_frame_end asserts (flush partial buffer with marker bit)
  3. Previously recorded frame_end_pending with 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

ParameterDefaultDescription
MTU1500Maximum Ethernet payload size
PAYLOAD_TYPE96RTP dynamic payload type
SSRC0x12345678Synchronization 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/1001
  • a=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