Is there a crate or tutorial for building a minimal client-server (not p2p) voice chat server? (like a mini-discord)
At a thousand foot view, this is basically having the clients open up udp / webrtc, and the server just routing the packets around. However, googling around, all I'm getting are results on:
I tried to figure out how to do something like this a year or so ago, and although I never got very far, I can at least share some crates you might find useful:
@gretchenfrage : Thanks for sharing. I've played with cpal a bit, but never used either audiopus or speexdsp-resampler. Any other advice from your experiences ?
Naively, I feel like there should be a way to use webrtc (via rust/wasm32) in the browser to capture audio + convert to webrtc/udp packets, then the rust server "just" needs to decode, remix, encode, and send it back out. Unfortunately, due to some complexity I am unaware of, this becomes a really messy problem and existing solution seems to offload this to VOIP software.
I made a very simple client-server with audiopus, cpal and UdpSocket (client microphone -> server speaker). The hardest part was buffering (avoid buffer overflow or underflow). I used ring-channel between the audiopus and cpal, and a custom channel (like a ring buffer but where reading does not overflow) between audiopus and UdpSocket, and it works well.