How to make the microphone-captured audio play in real time?

That’s fine. If the microphone gain is set too high, it becomes a bunch of buzzing noise (amplifying the captured audio data by left-shifting), and if the gain is set to 0, this doesn’t happen (although there still seems to be a slightly noticeable background noise). I’m not sure whether this background noise can be further optimized?

Use WebRTC to amplify gain, search for WebRtcAgc_Create, WebRtcAgc_Process