I have the following setup:
Core Audio Callback -> Circular Buffer -> libLAME -> Circular Buffer -> libShout
This all works fine until I start doing any intensive work at which point the thread doing the encoding (libLAME) and the thread doing the streaming (libShout) is throttled and things begin to go down hill very quickly (basically the server gets audio every 2-5 sec rather than every 200 msec or less like it should and the stream becomes garbled).
I have tried the following:
- Encoding and Streaming on the one thread
- Encoding and Streaming on their own threads
- Setting the priority of the thread(s) to high
- Setting the thread(s) to realtime threads (which appears to fix it for the most part except for the fact that everything else is then throttled way too much)
I am pretty much using the stock standard example code for libLAME and libShout. i.e. Set them up for the audio format and server, then loop whilst data is available in the buffers.
What I don't understand is why the threads are being throttled when the CPU usage is maxing out at 80% and the threads aren't blocking whilst waiting on the other thread.
Any help with this would be greatly appreciated.