Step 5 (SAP): announce the stream via SAP

- aes67_sdp_sap: SAP (RFC 2974) announcer task. SAPv1 to
  239.255.255.255:9875 every 30 s and within 1 s of any SDP change
  (config save, GM change), with the old hash deleted first. Active while
  aes67.discovery = sap, the stream is enabled, the AES67 interface has
  an IP and a PTP GM is known. Deletion when that stops and at shutdown
  (reboot/OTA) via a shutdown handler. TTL = aes67.ttl.
- Docs: SAP implementation notes; session_ver bump on GM change still open.
- Verified with a SAP listener: 30 s repeats with a stable hash; rename
  -> delete old + announce new (o= version follows); manual -> delete;
  sap -> announce; reboot and OTA -> delete at shutdown, first announce
  after boot only once the GM is known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 06:57:47 +10:00
parent 044e9913a7
commit f3779696d5
4 changed files with 153 additions and 4 deletions
+2
View File
@@ -87,6 +87,8 @@ When this device is the GM, offset/frequency/delay show "–".
- Discovery: manual (SDP export only) or SAP. NMOS IS-04/05 is a possible future option (Riedel SIC cards have an NMOS tab).
- SDP: v, o (aes67 IP, session_id, session_ver), s, c=mcast/ttl, t=0 0, a=clock-domain:PTPv2 <dom>, m=audio port RTP/AVP pt, a=rtpmap, a=recvonly, a=ptime, a=ts-refclk:ptp=IEEE1588-2008:<gm>:<dom>, a=mediaclk:direct.
- SAP to 239.255.255.255:9875 every 30 s, plus immediately on change; deletion packet on disable or shutdown.
- Implemented (aes67_sdp_sap): SAPv1, payload type `application/sdp`, msg id hash = 16-bit hash of the SDP, TTL = aes67.ttl. The SDP is checked once a second; on a change the old hash is deleted before the new one is announced. Nothing is announced until a PTP GM is known (else ts-refclk would be all zeros). Shutdown deletion via `esp_register_shutdown_handler` (covers reboot and OTA).
- Not done yet: bumping session_ver on a GM change (needs a firmware-side config write; relevant once the device can become GM, step 6). A GM change already re-announces immediately with the new ts-refclk.
- Media 2 (ST 2022-7 redundancy): not possible on single-port boards like the ESP32-P4-ETH. Keep the schema open for a `mcast2`/`port2` pair on dual-NIC hardware (Riedel applies one PTP config to both Media 1 and Media 2).
## AES67 RX (future, for receiver projects) — Riedel Director 4-wire input defaults