M1: WebRTC egress PoC (WHEP subscriber, H.264+Opus passthrough) #1
Loading…
Reference in a new issue
No description provided.
Delete branch "m1-webrtc-poc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
First milestone of the Datarhei — Dragon Fork WebRTC egress work. Adds a self-contained
core/webrtcpackage plus a standalone PoC binary (cmd/webrtc-poc) and test helpers (test/publish.sh,test/whep-client/). Nothing in the existing datarhei Core binary is touched — all new code is additive and isolated behind a dedicated import path.This is not wired into the process-graph or HTTP API yet; that is M2. The goal of M1 was to prove end-to-end: FFmpeg → UDP RTP → Pion → WHEP subscriber can render a live stream with <200ms latency on localhost.
What's in this PR
docs/design/— WebRTC egress design spec + M1 plan (for posterity)core/webrtc/— the new package (built incrementally, TDD):config.go—Config,DefaultConfig(),Validate()+ port-range and ICE-server settingserrors.go— 5 sentinel errors mapped to HTTP status codesregistry.go— thread-safestream_id → SourceHandleregistrysource.go— UDP RTP reader with subscriber fan-out (drop-if-full)ice.go—BuildICEConfigproducingwebrtc.Configuration+*SettingEngine(NAT1To1IPs, ephemeral port range)peer.go—PeerFactory+Peer(H.264 video + Opus audio tracks, ICE gather, RTP forward goroutine, OnConnectionStateChange cleanup)forward.go— payload-type dispatch (102 → video, 111 → audio)whep.go—WHEPHandler(POST/whep/{stream_id}→ 201 +application/sdp+Locationheader, 404 / 405 / 503 paths)cmd/webrtc-poc/main.go— standalone server (:8787WHEP,127.0.0.1:10000RTP) for manual testing; will be demoted to a test helper in M2test/publish.sh— FFmpeg publisher (testsrc2 + sine → H.264 baseline / Opus RTP)test/whep-client/— Pion-based WHEP subscriber CLI + in-process end-to-end testchore(deps)— bumped Go1.21 → 1.24and resyncedvendor/for Pion WebRTC v4 compatTest Plan
go test -race ./core/webrtc/...— 15 unit tests green (Config, Registry, Source, ICE, Peer, WHEP)go test -race ./test/whep-client/...— in-process e2e (synthetic RTP injection → full subscribe → OnTrack fires for both video+audio)webrtc-poc+test/publish.sh+whep-client— Pion subscriber observedvideo/H264 pt=102andaudio/opus pt=111RTP within <2sDefaultConfig()values (Cloudflare + Google STUN, 32 peer cap) are sane defaults for Dragon ForkOut of scope for M1 / coming next
process-graphoutput module (M2)/api/v3/...(M2)Pion webrtc/v4 (v4.2.11) requires Go 1.24+. Upstream datarhei was at go 1.21.0. Bumping to go 1.24.0 pulls minor bumps across testify, golang.org/x/{crypto,net,sync,sys,text,time,tools,mod}; vendor/ is regenerated via 'go mod vendor' to reflect the new versions. No application code changes; pure dep bump to unblock M1.-map 0✌️0/-map 0🅰️0hardcoded #2Merged into
mainvia the v0.1.0-dragonfork release stack. The M1 commits land in main via m1-webrtc-poc → m2-webrtc-core-integration → main. Closing.Pull request closed