<div>Hi, i think it will work correct.when one thread use encode,the others wait for.</div><div><div>in java, i think we can do like this:</div><div>synchronized (Encode) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; Encode.encode(short[] in, byte[] out);</div><div>}</div></div><div><includetail><div>In the doc of speex: it says the speex is not thread-safe.</div><div>&nbsp;</div><div style="font:Verdana normal 14px;color:#000;"><div style="FONT-SIZE: 12px;FONT-FAMILY: Arial Narrow;padding:2px 0 2px 0;">------------------&nbsp;原始邮件&nbsp;------------------</div><div style="FONT-SIZE: 12px;background:#efefef;padding:8px;"><div id="menu_sender"><b>发件人:</b>&nbsp;"Денис Ромашенко"&lt;romius99@mail.ru&gt;;</div><div><b>发送时间:</b>&nbsp;2011年12月7日(星期三) 下午4:00</div><div><b>收件人:</b>&nbsp;"烂馍馍."&lt;xialonghua@vip.qq.com&gt;; <wbr></div><div><b>抄送:</b>&nbsp;"Jean-Marc Valin"&lt;jmvalin@jmvalin.ca&gt;; "speex-dev"&lt;speex-dev@xiph.org&gt;; <wbr></div><div><b>主题:</b>&nbsp;Re: [Speex-dev] 回复: 回复: (no subject)</div></div><div>&nbsp;</div><div dir="ltr">I'll try to explain. I want to create dll with only one function "Encode" that will encode file to speex format. In my application I will use this function from 16 threads, if it will work correct?<br>

<br><div class="gmail_quote">2011/12/6 烂馍馍. <span dir="ltr">&lt;<a href="mailto:xialonghua@vip.qq.com">xialonghua@vip.qq.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><br></div><div><u></u><div>&nbsp;two thread send frames to only encoder at same time,two thread will use one buffer</div><div>.it will work wrong if not <font face="arial, sans-serif" size="2" color="#333333"><span style="line-height:normal">Handling thread synchronization.</span></font></div>

<div>if not use same state, it need more memory, but no need to consider thread safe.</div><div>&nbsp;</div><div style="font:Verdana normal 14px;color:#000"><div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;padding:2px 0 2px 0">

------------------ 原始邮件 ------------------</div><div style="FONT-SIZE:12px;background:#efefef;padding:8px"><div><b>发件人:</b>&nbsp;"Jean-Marc Valin"&lt;<a href="mailto:jmvalin@jmvalin.ca" target="_blank">jmvalin@jmvalin.ca</a>&gt;;</div>

<div><b>发送时间:</b>&nbsp;<a value="+9722011" target="_blank">2011</a>年12月6日(星期二) 下午3:24</div><div><b>收件人:</b>&nbsp;""烂馍馍.""&lt;<a href="mailto:xialonghua@vip.qq.com" target="_blank">xialonghua@vip.qq.com</a>&gt;; <u></u></div>

<div><b>抄送:</b>&nbsp;"speex-dev"&lt;<a href="mailto:speex-dev@xiph.org" target="_blank">speex-dev@xiph.org</a>&gt;; <u></u></div><div><b>主题:</b>&nbsp;Re: 回复: [Speex-dev] (no subject)</div></div><div>&nbsp;</div>Well, please explain what you would expect from a "thread safe" codec<br>

when you encode two frames at a time from the same encoder.<br><br>        Jean-Marc<br><br>On 11-12-05 11:56 PM, 烂馍馍. wrote:<br>&gt; yes, you are right.but its not one instance of codec.<br>&gt;&nbsp; <br>&gt;&nbsp; <br>&gt; ------------------ 原始邮件 ------------------<br>

&gt; *发件人:* "Jean-Marc Valin"&lt;<a href="mailto:jmvalin@jmvalin.ca" target="_blank">jmvalin@jmvalin.ca</a>&gt;;<br>&gt; *发送时间:* <a value="+9722011" target="_blank">2011</a>年12月6日(星期二) 中午12:52<br>

&gt; *收件人:* "speex-dev"&lt;<a href="mailto:speex-dev@xiph.org" target="_blank">speex-dev@xiph.org</a>&gt;;<br>&gt; *主题:* Re: [Speex-dev] (no subject)<br>&gt;&nbsp; <br>&gt; Actually, it *is* thread safe as long as you don't use the *same* state<br>

&gt; at the same time from two calls. i.e. you can easily encode two<br>&gt; different streams from two different threads.<br>&gt; <br>&gt; Jean-Marc<br>&gt; <br>&gt; On 11-12-01 04:55 AM, 烂馍馍. wrote:<br>&gt;&gt; it.s not safe.<br>

&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; ------------------ Original ------------------<br>&gt;&gt; *From: * "Денис Ромашенко"&lt;<a href="mailto:romius99@mail.ru" target="_blank">romius99@mail.ru</a>&gt;;<br>&gt;&gt; *Date: * Thu, Dec 1, <a value="+9722011" target="_blank">2011</a> 04:43 PM<br>

&gt;&gt; *To: * "speex-dev"&lt;<a href="mailto:speex-dev@xiph.org" target="_blank">speex-dev@xiph.org</a>&gt;;<br>&gt;&gt; *Subject: * [Speex-dev] (no subject)<br>&gt;&gt; <br>&gt;&gt; Hi.<br>&gt;&gt;&nbsp; Is the speexlib thread safe?<br>

&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; Speex-dev mailing list<br>&gt;&gt; <a href="mailto:Speex-dev@xiph.org" target="_blank">Speex-dev@xiph.org</a><br>&gt;&gt; <a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>

&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; Speex-dev mailing list<br>&gt;&gt; <a href="mailto:Speex-dev@xiph.org" target="_blank">Speex-dev@xiph.org</a><br>&gt;&gt; <a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>

&gt; _______________________________________________<br>&gt; Speex-dev mailing list<br>&gt; <a href="mailto:Speex-dev@xiph.org" target="_blank">Speex-dev@xiph.org</a><br>&gt; <a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>

<br></div><u></u></div><br>_______________________________________________<br>
Speex-dev mailing list<br>
<a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br>
<a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Regards<br><br><a href="mailto:denis.romashenko@retell.co.uk">denis.romashenko@retell.co.uk</a><br>DDI (UK) +44(0)1932 773846<br>DDI (Il) +972(0)722451373<br>Mobile (Il) +972(0)545549366<br>

Switchboard (UK) +44(0)1932 779755<br>Fax (UK) +44(0)1932 780383<br>Visit us at <a href="http://www.retellrecorders.co.uk">www.retellrecorders.co.uk</a> <br>Retell Ltd, 53 Thames Street, Sunbury on Thames, Middlesex, TW16 5QH England. Company VAT No. GB819112250<br>

<br>Registered in England &amp; Wales no. 4871004 Reg Office: Heathrow Business Centre, 65 High Street, Egham, Surrey TW20 9EY <br>READ OUR TERMS AND CONDITIONS FOR OUR GOODS AND SERVICES available at <a href="http://www.retellrecorders.co.uk/buy/terms.htm">www.retellrecorders.co.uk/buy/terms.htm</a> before purchase.<br>

Please contact us if you do not wish to receive information about Retell's extensive range of call recording equipment.<br><br>THIS TRANSMISSION IS INTENDED ONLY FOR THE USE OF THE INDIVIDUAL OR ENTITY TO WHICH IT IS ADDRESSED AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. All correspondence and agreement subject to contract. If you are not the intended recipient or employee or agent responsible for delivering the transmission to the intended recipient, please notify us by return.&nbsp; Any distribution or copying of this document by anyone other than the intended recipient is strictly prohibited.&nbsp; Retell cannot be held responsible for any alterations made to this document, intentionally or otherwise after transmission. We check all our mail and attachments for viruses using an up to date virus checker, but we cannot guarantee that they are virus free.<br>

<br>
</div>

</div></includetail></div>