NSpeex Multithreading?

Oct 15, 2012 at 10:25 PM

Hello, I'm having issues with NSpeex. I have a voice chat system that uses NSpeex, and I've had reports that it runs poorly on older computers and mobile devices. I figured I could probably improve performance by running Speex encoding operations on another thread.

So I have a single function I can call in my code that calls another function, which in turn makes calls to the encoding functions in Speex. Great. I can call my function from the main thread, and everything works perfectly (and audio quality is great, btw).


As soon as I move this function into another thread via ThreadPool.QueueUserWorkItem, suddenly I get various errors from NSpeex, ranging from Invalid Sideband Mode to Index Out Of Range.

Is there something I'm doing wrong here, or is NSpeex not going to work for multithreading?

(I should also point out I had to make a few modifications to NSpeex in order to get it to compile under .NET 3.0 instead of 4.0)