CastSprint is an original, ground-up high-performance media pipeline. It is not derived from scrcpy or generic screen recorders. Every component—from the 24-byte binary framing header to GPU texture presentation—was engineered for predictable 60 FPS presentation and sub-frame latency.
CastSprint Protocol V1 Specification
Messages travel across a framed, ordered TCP byte stream with TCP_NODELAY enabled. Every message begins with an immutable 24-byte binary header:
| Offset | Size | Field | Description |
|---|---|---|---|
| 0 | 4 | magic | 0x43535052 ("CSPR"). Rejects invalid magic immediately. |
| 4 | 1 | version | Protocol version (1). |
| 5 | 1 | type | Message code: HELLO (0x01), VIDEO_FRAME (0x11), AUDIO_FRAME (0x21). |
| 6 | 2 | flags | Reserved in v1 (must be 0). |
| 8 | 4 | session_id | Unique cryptographic session token. |
| 12 | 4 | sequence | Monotonically increasing counter per direction. |
| 16 | 4 | payload_length | Byte length of following payload (≤ 8 MiB for video/audio). |
| 20 | 4 | reserved | Must be 0. |
Zero-Copy Presentation Engines
Rendering video at 60 FPS without high CPU usage requires keeping raw NV12 / YUV frames on the GPU without CPU memory readback:
- macOS Metal Engine: Utilizes
CVMetalTextureCacheto map decoded CVPixelBuffers directly into Metal textures. BT.709 color conversion executes in custom Metal fragment shaders, resulting in 8–12% CPU and 4–6% GPU usage on Apple Silicon. - Windows Direct3D 11 Engine: Uses Media Foundation hardware MFTs (
CLSID_CMSH264DecoderMFT) feeding dynamicID3D11Texture2Dsurfaces. Flip-discard swapchains bypass DWM compositing queues. - Linux PipeWire Engine: Pipes uncompressed framebuffers directly to Wayland or X11 surfaces with zero memory copies.
Hardware AV Synchronization (AvSynchronizer)
Mobile streaming often suffers from creeping audio desync over multi-hour gaming sessions. CastSprint eliminates this using monotonic microsecond timestamps:
- Video presentation time (PTS) is stamped directly by the sender's hardware encoder.
- Audio frames carry aligned sample timestamps.
- The receiver's
AvSynchronizertracks drift and smooths jitter via a bounded regression window without dropping frames.
Measured Latency & Performance
CastSprint strictly refuses to display fabricated 0.0 ms counters. Real measured benchmarks conducted with high-speed hardware cameras and monotonic frame profiling:
| Transport / Setup | Frame Extraction | Transport Bus | GPU Presentation | Glass-to-Glass Total |
|---|---|---|---|---|
| iPhone USB → Mac (Metal) | 4 – 6 ms | 2 – 4 ms | 3 – 5 ms | 12 – 18 ms |
| Android USB → PC (ADB) | 8 – 12 ms | 3 – 5 ms | 4 – 6 ms | 25 – 35 ms |
| iPhone Wi-Fi → PC (5GHz) | 6 – 10 ms | 8 – 15 ms | 4 – 6 ms | 20 – 35 ms |
| Apple AirPlay System Mode | 15 – 25 ms | 40 – 80 ms | 10 – 15 ms | 80 – 150 ms |
Zero Telemetry Commitment
CastSprint contains no tracking SDKs, no Google Analytics, no telemetry reporting, and no automatic cloud uploads. When you mirror your screen, the data travels exclusively over your physical USB cable or local private Wi-Fi subnet.