Hardware decoding architecture.
Transparent latency budgets.
The Android Screen Mirror tool streams video and audio from physical Android devices directly to Chromium-based browsers without third-party desktop client software. This document details the technical protocol, pipeline latency breakdown, and engineering specifications.
Latency budget breakdown (< 35ms total)
Real-time tactile interaction requires keeping round-trip latency below the human perception threshold of approximately 50ms. The direct USB pipeline is optimized across four consecutive stages:
Total Input-to-Display Latency = T_touch + T_adb + T_render + T_encode + T_transport + T_decode + T_vsync
- Touch Injection (T_touch + T_adb): ~2–4 ms. Pointer events captured on the browser canvas are normalized to device display coordinates and forwarded via binary WebSocket packets directly to the ADB daemon.
- Device Render & H.264 Encoder (T_render + T_encode): ~8–12 ms. On-device hardware MediaCodec encodes native Surface frames to raw H.264 NAL units (baseline/main profile, zero B-frames).
- USB / WebSocket Transport (T_transport): ~1–3 ms. USB 3.0 Type-C provides sustained throughput above 400 Mbps with jitter consistently under 2 ms.
- Browser WebCodecs GPU Decoding (T_decode): ~1–2 ms. Chromium’s VideoDecoder API feeds NAL units directly to the host PC GPU hardware decoder without copying through HTML5 video elements.
- Host Display Refresh (T_vsync): ~8.3–16.6 ms (depending on 60 Hz or 120 Hz monitor refresh rate).
Video stream parameters
Video streaming uses dynamic bitrate scaling based on active connection mode:
- Ultra Fast (USB 3.0): 1080p (1920×1080 native), 60 FPS, 8 Mbps bitrate target, intra-refresh keyframe interval of 1 second.
- Audio Sync Focus: 1080p, 60 FPS, 6 Mbps bitrate, optimized buffer queueing for zero audio-video drift.
- Low Bandwidth / Battery Saver: 720p (1280×720), 30 FPS, 4 Mbps target, reducing host and device CPU power draw by ~45%.
Audio forwarding architecture
Audio capture utilizes Android 11+ internal AudioPlaybackCapture framework:
Audio pipeline = Android PCM Capture (48 kHz) → Opus Encoder (128 kbps) → WebSocket → Web Audio API Decoded AudioBuffer
A drift-compensation algorithm monitors presentation timestamps (PTS) against the host system clock. If buffer jitter exceeds 20ms during sustained playback, sample stretching is applied during silent frames to restore synchronization without audible pitch distortion.
Security and isolation boundaries
- Local Execution: Streaming traffic flows strictly through loopback (
127.0.0.1) and USB connections. No video frames, keystrokes, or clipboard data are uploaded to external cloud servers. - Browser Sandbox: All touch, pointer, and keyboard handling operates within the standard browser security sandbox.
- DRM & Protected Content: In compliance with Android OS security policies (Widevine L1), media protected by hardware DRM (such as Netflix or banking applications with
FLAG_SECURE) displays as black frames by design.
Device compatibility
Supported on devices running Android 5.0+ (Lollipop) for video, and Android 11+ (Red Velvet Cake) for native internal audio forwarding without root permissions. Requires USB Debugging enabled in Android Developer Options.