$ show meetecho/janus-gateway
Janus is a general-purpose WebRTC media server and gateway written in C. It provides a modular architecture with a core daemon that dynamically loads plugins for various use cases (video conferencing, audio bridging, streaming, SIP, etc.), transports (HTTP, WebSockets, MQTT, RabbitMQ, Unix sockets), and event handlers. The server handles ICE/DTLS/SRTP for WebRTC peer connections, relays RTP/RTCP media between participants, and supports advanced features like simulcast, SVC, recording, and post-processing. A JavaScript client library (janus.js) is provided for browser integration. The system is production-grade, actively maintained, and widely deployed.
The LLM identified 5 files worth highlighting for reuse:
Defines the standard plugin API (janus_plugin struct with init, destroy, handle_message, incoming_rtp, etc.) and the core callbacks (janus_callbacks). This interface allows any third-party developer to create new plugins that integrate seamlessly with the Janus core. It is self-contained, versioned, and reusable for building custom WebRTC media processing modules.
Provides a comprehensive SDP parser, generator, and manipulator. Functions like janus_sdp_parse, janus_sdp_generate_offer, and janus_sdp_generate_answer_mline are used across all plugins for WebRTC offer/answer handling. The module is isolated (depends only on glib and jansson) and can be extracted for any project needing SDP processing.
Implements a generic media recorder that saves RTP frames into a custom .mjr container format. The API (janus_recorder_create, janus_recorder_save_frame, janus_recorder_close) is used by multiple plugins for recording audio/video streams. It is self-contained and could be reused in other media applications needing a simple recording format.
Provides a lightweight reference counting mechanism (janus_refcount) with atomic operations for thread-safe lifecycle management. Used extensively across the codebase for sessions, SDP objects, and transport handles. This is a small, reusable utility that can be dropped into any C project needing refcounting.
An audio level limiter adapted from the WebRTC project, with SIMD-optimized implementations (AVX2, SSE4.2) and runtime CPU detection. It provides a clean API (WebRtcAgc_Process, etc.) for limiting audio signal peaks. This component is standalone and can be reused in any audio processing pipeline requiring peak limiting.