[Speex-dev] 回复: 回复: 回复: (no subject)

Steve Checkoway s at pahtak.org
Wed Dec 7 01:48:37 PST 2011

On Dec 7, 2011, at 0:14 , 烂馍馍. wrote:

> Hi, i think it will work correct.when one thread use encode,the  
> others wait for.
> in java, i think we can do like this:
> synchronized (Encode) {
>        Encode.encode(short[] in, byte[] out);
> }

The encoder and decoder use a state structure to maintain all state as  
far as I know. As long as you're using different state as the first  
argument to the various speex encode and decode functions for each  
thread, you're fine. Why do you think otherwise?

> In the doc of speex: it says the speex is not thread-safe.

To quote from the documentation,

> One important thing to know is that libspeex calls are reentrant,  
> but not thread-safe. That means that it is fine to use calls from  
> many threads, but calls using the same state from multiple threads  
> must be protected by mutexes.

It's pretty clear that this is safe as long as you use a different  

Steve Checkoway

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4745 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20111207/1c273a9e/attachment.bin 

More information about the Speex-dev mailing list