Skip to content

Receive plain RTP from Majestic outgoing over UDP (unicast and multicast) #68

Closed

Description

@compot-dev

Split out of #7.

Majestic can push the stream itself, with no RTSP: outgoing destinations (/api/v1/outgoing.json, web UI "Outgoing") with udp://host:port send plain RTP. This is the usual OpenIPC setup for FPV and for feeding several receivers from one encoder. Add a slot type that receives it.

What the stream looks like (measured on hi3516av300 Majestic):

  • Always RTP, never MPEG-TS or a bare Annex-B stream.
  • PT 96 = H.264 (RFC 6184), PT 97 = H.265 (RFC 7798); FU-A / FU fragments, ~1200 bytes (rtsp.naluSize).
  • SPS/PPS (and VPS) are repeated in band before every IDR, so a receiver can join mid-stream with no SDP.

Scope

  • Slot URL form, e.g. udp://@:5600 (unicast, listen on a port) and udp://@239.1.2.3:5600 (multicast group, optional source).
  • Receiver: DatagramSocket for unicast, MulticastSocket.joinGroup() on the active interface for multicast. Large SO_RCVBUF.
  • Wi‑Fi: hold a WifiManager.MulticastLock while a multicast slot is playing; add CHANGE_WIFI_MULTICAST_STATE to the manifest. Ethernet boxes (AG-216) probably do not need it; verify.
  • Codec from PT (96/97), with a per-slot override for non-default PTs. Decoder configured from in-band parameter sets: no output until the first SPS/PPS + IDR.
  • Feed packets to the existing depacketizer through onPacket(CHANNEL_VIDEO, ...); no RTSP, so "connected"/watchdog is based on incoming packets only.
  • Reorder/loss handling as in RTSP over UDP unicast, with fallback to TCP #67 (shared code).
  • Audio: Majestic can add audio to a destination; decide whether to support it here or later (the PT and codec are not described anywhere, so it needs a per-slot setting).
  • Several slots on different ports / groups at the same time; two slots on the same port must be rejected.

To verify first

  • That Majestic actually sends to a multicast group address (udp://239.x.x.x:port) and with what TTL; not checked yet.

Tests

Activity

  1. compot-dev commented on Oct 12, 2026

    @compot-dev
    CollaboratorAuthor

    UI for this receiver is prepared in #71 (no receiver code there, so no overlap with the receiver work):

    • the ninth cell of the 3×3 grid is reserved for the pushed stream and shows UDP RTP · port 5600 with this device's address (Decoder.UDP_RTP_PORT, Decoder.udpHintText(), Decoder.localIpv4());
    • U in the menu row (after 8) shows that cell full-screen (Decoder.onShowUdp() / leaveUdpView(), MenuManager.setUdpShown()); a slot number or Q leaves it.

    The receiver can replace the hint view with a SurfaceView in both places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions