moq-boy-0.2.4 is not a library.
MoQ Boy: a crowd-controlled Game Boy Color emulator that streams over MoQ.
Architecture:
- Emulator thread (blocking): runs the Game Boy at ~59.73fps, captures framebuffers and audio samples, publishes status JSON.
- Video encoder thread: receives RGBA frames, converts to H.264, publishes.
- Audio encoder (on emulator thread): resamples and encodes to Opus.
- Monitor tasks (async): watch video/audio track subscriptions to pause/resume the emulator when no viewers are watching.
- Viewer handler (async): discovers viewer broadcasts, relays button commands to the emulator.
Pause/resume state machine:
video_active ─┐
├─ both false → paused (emulation stops, condvar blocks)
audio_active ─┘
either true → resumed (condvar notified)
On resume → force video keyframe, re-anchor audio epoch
Emulator state is preserved across pauses: a new viewer joining after a break picks up mid-playthrough rather than seeing a fresh boot.