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
@@ -6,7 +6,10 @@
#include "esp_err.h"
// Registers GET /stream.sdp. (SAP: step 5.)
// Registers GET /stream.sdp and starts the SAP announcer (RFC 2974): 239.255.255.255:9875 every
// 30 s and on SDP change while aes67.discovery is "sap", the stream is enabled and a PTP GM is
// known (else ts-refclk would be all zeros); deletion
// when that stops and at shutdown.
esp_err_t aes67_sdp_sap_init(void);
// Build the current SDP (RFC 4566 + RFC 7273, AES67). Returns the length, or 0 if it didn't fit.
size_t aes67_sdp_build(char *buf, size_t size);