wahjam/wahjam — pull request #49 by stefanha (2012-04-19 21:25:26+00:00)
Title: Client polling removal

This patch series builds upon the server-polling-removal series. This time we refactor qtclient to use Qt signals/slots and drop ClientRunThread. The result is that we use signals/slots for receiving network messages and a timer for processing local input samples which were queued up by the audio thread.

I think we will continue to use a timer that invokes NJClient::Run() instead of introducing synchronization between the audio thread and the Qt main thread because of the real-time requirements of the audio thread. Any synchronization risks delaying the audio thread and dropping samples. I think the model should be:
1. The Qt main thread decompresses incoming audio and places samples into a ringbuffer for the audio thread.
2. The audio thread mixes local input with the uncompressed remote audio from the ringbuffer. It also places local input samples into another ringbuffer for the Qt main thread.
3. The Qt main thread periodically consumes the local input ringbuffer, compresses the audio, and sends it to the server.

Anyway, it's nice to turn NJClient into a QObject and drop the ClientRunThread. This series gets us a little closer to cleaning up the codebase and replacing legacy code with Qt classes.