-
Notifications
You must be signed in to change notification settings - Fork 0
11 Realtime Audio Video Calling Architecture
Corresponding Specifications:
sys-arch/25-android-direct-hardware-surface-zero-copy-media-architecture.md,sys-arch/26-rust-first-audio-dsp-resampling-aec-ns-agc-architecture.md,sys-arch/29-realtime-calls-media-session-protocol-architecture.md,sys-arch/ui-ux-07-calls-realtime-media-architecture.md
Key Crates:crates/siar-calls,crates/siar-media-core,crates/siar-media-audio,crates/siar-media-av1,crates/siar-media-android
Realtime voice and video sessions in SIAR operate over direct P2P transport links (LAN, Wi-Fi Direct, Iroh QUIC) using a lightweight binary signaling protocol in siar-calls:
stateDiagram-v2
[*] --> Idle
Idle --> OutgoingRinging: Initiator emits CallOffer
Idle --> IncomingRinging: Receiver receives CallOffer
IncomingRinging --> Connecting: Receiver accepts CallAnswer
OutgoingRinging --> Connecting: Initiator receives CallAnswer
Connecting --> ActiveSession: DTLS-SRTP / Iroh Stream Handshake Complete
ActiveSession --> Renegotiating: Video Added / Codec Switched
Renegotiating --> ActiveSession: Handoff Confirmed
ActiveSession --> Terminated: CallEnd / Timeout / Network Loss
IncomingRinging --> Terminated: CallReject / Busy
OutgoingRinging --> Terminated: Cancelled / No Answer
Terminated --> [*]
The audio subsystem in siar-media-audio processes microphone input through a real-time digital signal processing pipeline:
[Microphone Audio 48 kHz]
|
v
[Acoustic Echo Cancellation (AEC)] <--- [Speaker Reference Channel]
|
v
[Noise Suppression (NS - Spectral Subtraction)]
|
v
[Automatic Gain Control (AGC - Dynamic Range Compression)]
|
v
[Voice Activity Detector (VAD)] ---> (Silence Suppression / DTX)
|
v
[Opus Encoder (6–64 Kbps VBR)] ---> [Network Packetizer]
- Sample Rate: 48,000 Hz high-fidelity stereo or mono voice.
- Dynamic Bitrate: 8 Kbps (low-bandwidth emergency mesh) to 64 Kbps (crystal-clear HD call).
- Packet Loss Concealment (PLC): Generates synthetic pitch-period waveforms when isolated network packets drop.
SIAR selects the AV1 video standard for maximum compression efficiency over bandwidth-constrained mesh and wireless links:
graph TD
subgraph Android Native Surface Pipeline
Cam[Camera2 API / NDK Capture] -->|Hardware Buffer| SurfaceTexture[SurfaceTexture / GraphicBuffer]
SurfaceTexture -->|Zero-Copy NDK Pointer| HWEncoder[MediaCodec AV1/H.264 Encoder]
HWEncoder -->|Encoded Bitstream| JNIRust[Rust Media Bridge]
end
JNIRust -->|Encrypted UDP / QUIC| RemotePeer[Remote Peer]
subgraph Remote Display Pipeline
RemotePeer -->|Bitstream Stream| JNIRecv[Rust Network Receiver]
JNIRecv -->|Zero-Copy Buffer| HWDecoder[MediaCodec Hardware Decoder]
HWDecoder -->|Native ANativeWindow| GLSurface[ANativeWindow / Direct Surface View]
end
By binding Android NDK ANativeWindow pointers directly to the hardware decoding pipeline, frames are rendered straight into the GPU framebuffer without copying multi-megabyte uncompressed pixel buffers through the Java/Kotlin garbage-collected heap.
The AdaptiveJitterBuffer continuously estimates network delay variance:
-
Delay Adaptation: Automatically expands buffer depth during bursty latency spikes and contracts during smooth transmission to minimize end-to-end mouth-to-ear delay (
$< 150\text{ms}$ target). -
BBR Congestion Feedback: Dynamically signals the AV1 encoder to adjust resolution (
$720p \rightarrow 480p \rightarrow 240p$ ) and frame rate ($30\text{fps} \rightarrow 15\text{fps}$ ) before packet drops occur.
SIAR — Survivable Identity & Autonomous Routing
Open Source Mesh & DTN Communications Platform | Dual Licensed under MIT / Apache-2.0 / Commercial
Documentation Index • GitHub Repository • System Specifications
- 04-Autonomous-Routing-and-Policy-Engine
- 05-Proximity-and-Hardware-Transports
- 06-Delay-Tolerant-Networking-and-Bundle-Forwarding
- 07-Battery-Aware-Scheduling-and-Emergency-Mesh
- 08-Offline-Event-Log-and-Outbox-Engine
- 09-Robust-Blob-Storage-and-Chunk-Transfers
- 10-Crash-Recovery-and-Data-Portability
- 11-Realtime-Audio-Video-Calling-Architecture
- 12-Cross-Platform-Client-Architecture
- 13-Messaging-Timeline-Composer-and-Inbox
- 14-Contacts-Groups-and-Security-Center
- 15-Nearby-Discovery-and-Out-of-Band-Pairing
- 16-Notifications-Presence-and-Background-Lifecycle
- 17-Local-Knowledge-Retrieval-and-Search
- 25-Design-System-Tokens-and-Responsive-Layouts
- 26-UI-UX-Performance-Testing-and-Quality-Gates
- 18-Protocol-Extensions-and-WASM-Plugins
- 19-Headless-Daemons-and-Embedded-Nodes
- 20-C-ABI-FFI-and-Native-Language-Bindings
- 21-Testing-Fuzzing-and-Network-Diagnostics
- 22-Getting-Started-and-Developer-Guide
- 23-Off-Grid-Survival-and-Field-Operations-Guide
- 24-System-Comparison-and-Benchmarking