$ show ClassicOldSong/Apollo
Apollo is a self-hosted game streaming server, forked from Sunshine and rebranded for compatibility with Artemis (formerly Moonlight Noir) clients. In production, it captures the host's display (via DXGI, KMS, Wayland, or NvFBC), encodes video using hardware encoders (NVENC, AMD AMF, Intel QSV, VAAPI, VideoToolbox) and audio (Opus), then streams over the network using a combination of RTSP for session control and ENet for real-time transport. It also forwards keyboard, mouse, gamepad, and pen input back to the host, enabling low-latency remote gaming or desktop control. The architecture is a single-process C++ application with a multi-threaded design: separate threads for video capture, encoding, audio capture, network I/O, and control. It exposes a web-based configuration UI (Vue.js frontend served by an embedded HTTPS server) and implements the NVIDIA GameStream HTTPS API for client pairing and session management. Platform-specific code is isolated behind abstraction interfaces (e.g., platf::display_t, platf::input_t), with dedicated implementations for Windows, Linux, and macOS. External dependencies include Boost, FFmpeg, OpenSSL, ENet, and vendor-specific SDKs (NVENC, AMF, VAAPI, etc.). The codebase demonstrates solid engineering with a clear separation of concerns, a comprehensive build system (CMake with platform macros), and a growing test suite (Google Test). However, it carries technical debt from its forked natureβsome code still references 'Sunshine' while branding leans toward 'Apollo'βand there are incomplete features on macOS (e.g., placeholder functions for clipboard) and fragile workarounds for driver bugs. Overall, it is a functional, well-maintained application with reusable patterns for inter-thread communication, resource management, and platform abstraction.
The LLM identified 3 files worth highlighting for reuse:
Provides a generic mail-based communication system with safe::mail_t, safe::event_t, and safe::queue_t for decoupled, thread-safe message passing. The pattern is reusable in any multi-threaded C++ project needing lightweight, lock-free-like event signaling between producer and consumer threads.
Offers a collection of templated RAII wrappers (safe_ptr, uniq_ptr, dyn_safe_ptr) and guards (fail_guard, file_t) that simplify ownership and cleanup of system resources (file descriptors, OpenSSL objects, COM interfaces). These are highly portable and can be extracted into any C++ project that requires deterministic resource management without external dependencies.
Implements a simple, reusable thread pool (ThreadPool) and a higher-level task pool (TaskPool) that manage asynchronous function execution. The design is minimal, header-only, and depends only on standard C++ threading facilities, making it straightforward to adopt in other C++ applications that need parallel task dispatch.