WebRTC Group Video Conference HPA Server

Actions StatusHex pm

This repository contains the unified, lightweight RTP monorepo designed for high-performance WebRTC video conferencing in the SYNRC CHAT environment. It consolidates N2O WebSocket pages, room process supervisors, Mnesia persistence, and in-process GStreamer mixer port drivers into a single cohesive Erlang/OTP application.

1. Directory Blueprint

├── c_src/
│ └── gst.c # GStreamer WebRTC compositor C99 implementation
├── config/
│ ├── config.exs # Elixir Erlang/OTP Application Environment
│ ├── sys.config # Database directory, Eturnal TCP/UDP listeners, and N2O parameters
│ └── vm.args # Cluster node cookie and naming args
├── priv/
│ ├── static/ # Front-end dashboard and client scripts
│ │ ├── app/ #
│ │ │ ├── index.html # INDEX.HTML Page
│ │ │ └── login.html # LOGIN.HTML Page
│ │ └── rtp.css # RTP.CSS Styles
│ └── gst # compiled native C99 binary spawned by Erlang port
├── lib/
│ └── rtp
│ ├── live_stream.ex # HTTP Live Streaming (HLS) Server
│ ├── n2o_socket.ex # N2O Bandit WebSocket Proxy
│ ├── static.ex # Static Server
│ └── ws.ex # WebSocker Server
├── src/
│ ├── index.erl # N2O Nitro room chat history feed
│ ├── login.erl # N2O Nitro user session handler
│ ├── media_broker_srv.erl # supervised GStreamer compositor port manager (mp4 to S3 storage)
│ ├── mnesia_srv.erl # local database schema setup (disc_copies chat and room tables)
│ ├── n2o_signaling.erl # WebRTC SDP/ICE
│ ├── room_coordinator.erl # Main Gen Server
│ ├── routes.erl # Erlang/OTP Default Routes
│ ├── rtp_app.erl # Erlang/OTP Application
│ ├── rtp_sup.erl # Erlang/OTP Supervisor starting mnesia_srv and media_broker_srv workers
│ ├── rtp_syn.erl # RTP Pub/Sub (Redis replacement)
│ ├── rtp.app.src # Deps: [kernel, stdlib, inets, ssl, bandit, websock_adapter, n2o, nitro, kvs, syn, mnesia]
│ └── session_token.erl
├── mix.exs # Elixir Packages (Dependencies)
├── gst-nuttx.pdf # GStreamer MCU port to NuttX
├── rtp.pdf # GStreamer MCU Article in LaTeX
├── GST.md # GStreamer MCU
└── README.md # This file

2. Unified Architecture Topology

The simplified architecture integrates all real-time messaging, orchestration, database persistence, and TURN capabilities into a single monolithic Erlang node, delegating layout composting and recordings directly to local GStreamer port processes.

graph TD
subgraph "Client Browser"
ClientJS["Web Client"]
end
subgraph "Kubernetes Cluster (erp-rtp)"
Ingress["Nginx Ingress / K8s Service"]
subgraph "RTP Monolith Pod (Erlang Node)"
N2O_Gate["N2O WebSocket"]
Room_Coord["Room Coordinator"]
Syn_Reg["Syn Process Registry"]
Mnesia_DB["Mnesia DB"]
Eturnal["TURN Server"]
GST_Mixer["GStreamer Port"]
end
end
subgraph "Telemetry Namespace"
Otel_Col["OpenTelemetry Collector"]
OpenSearch["OpenSearch Log Store"]
Grafana["Grafana Visualizer"]
end
subgraph "Storage"
S3["S3 Object Storage"]
end
%% Client Traffic
ClientJS -->|Signaling WSS - Port 8081| Ingress
ClientJS -->|STUN/TURN Traffic - Port 3478| Eturnal
ClientJS -->|Dedicated Telemetry - Port 8082| Ingress
%% RTP Media Streams (WebRTC)
ClientJS --->|Upstream RTP - Port 10000-20000| GST_Mixer
GST_Mixer --->|Downstream Broadcast - Port 10000-20000| ClientJS
ClientJS <-->|Relayed WebRTC SRTP - Port 3478| Eturnal
%% Internal routing
Ingress -->|Signaling WSS - Port 8081| N2O_Gate
Ingress -->|Telemetry WSS - Port 8082| Otel_Col
%% Monolith orchestration
N2O_Gate <-->|Local Message Passing| Room_Coord
Room_Coord <-->|Registry Lookups| Syn_Reg
Room_Coord <-->|Save Chat logs & states| Mnesia_DB
Room_Coord -->|Spawn local composite mixer| GST_Mixer
%% Media output
GST_Mixer -->|Mixed MP4 Upload| S3
%% Observability Paths
N2O_Gate -->|OTLP Logs & Metrics| Otel_Col
Room_Coord -->|OTLP Logs & Metrics| Otel_Col
Eturnal -->|OTLP Metrics| Otel_Col
Otel_Col -->|Logs| OpenSearch
Otel_Col -->|Metrics| Grafana

3. Technical Features

3. Configuration & Ports

Erlang bindings and listeners are defined inside config/sys.config:

4. How to Run Locally

4.1 Prerequisites (macOS)

Install GStreamer tools and plugins (base, good, bad) using Homebrew:

$ brew install gstreamer

4.2 Start the Monolith

Due to macOS compiling NIF extensions in non-standard paths, launch the Rebar3 shell using the pre-configured script wrapper:

$ iex -S mix

This automatically exports OpenSSL/libyaml configurations, compiles the codebase, and launches the VM:

╔════════════════════════════════════════════════════════╗
ERP/1: RTP Server / Signaling & Telemetry
WS : ws://localhost:8001/ws/app/<page>.htm
HTTP: http://localhost:8081/app/login.htm
╚════════════════════════════════════════════════════════╝
Hardware : 10 Cores, 16 GB RAM
Max Rooms : 100 (heuristic based on cores)
Capacity : 5000 max participants (50 per room)
RTP Codecs : Opus (Audio), VP8, VP9, H.264 (Video)
(1)>

Once booted, access the video interface at http://localhost:8081/app/login.htm as shown in banner.

5. Media Pipeline Architecture and Delivery Nuances

The system employs an advanced, multi-modal GStreamer pipeline capable of synthesizing grid-composited media from real-time WebRTC ingest and demultiplexing it to heterogeneous endpoints. The architecture natively supports three distinct fragmentation and streaming topologies tailored to varied latency and browser compatibility constraints.

5.1 Fragmented Streaming Topologies

1. Fragmented MP4 (fMP4)

2. MPEG-TS (H.264 / AAC)

3. HEVC (H.265 / AAC)

5.2 Nuances of Live HLS Delivery and Caching Pathologies

Delivering micro-segmented live HLS playlists (index.m3u8) over a standard web server introduces critical HTTP caching pathologies that severely degrade playback continuity.

5.3 GStreamer Queue Topology and PTS Timestamp Preservation

The demultiplexing of raw compositor output to simultaneous WebRTC (RTP) and HLS (MPEG-TS) endpoints introduces critical timing and buffering challenges. The pipeline must be specifically architected to prevent frame dropping and Presentation Time Stamp (PTS) corruption.

ITU-T H-Series Recommendations

Requirements for passing interview for Zen Crypted RTP developer position.

Video Codecs:

Audio Codecs:

Packet Multimedia & MCU:

Security:

Control & Negotiation:

QoS & Timing:

Data Conferencing (N2O chat):

Articles

Credits