<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">Hi,</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">I have a few questions about the speex_jitter_buffer when used with DTX here goes:</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><br></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><span class="Apple-style-span" style="font-size: 14px; ">I want to use the speex_jitter_buffer with muliple streams (multi client) and with DTX so that clients will only transmit data when they are actually saying anything, but Im unsure of how the ticking is handled. </span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">I have 1 x SpeexJitter struct per client stream</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">Im using portaudio and Im planning on using the callback to iterate through all the buffers getting decoded frames. There is no upper limit (in theory) to how many client streams/buffers there can be and as far as I can see the speex_jitter_get(..) performs quite a bit of code. In this case just to iterate through all buffers calling get(...) is quite inefficient so Im considering implementing a </span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">int buffer_has_data(SpeexJitter* jitter)</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">{</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>int count = 0;<br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>jitter_buffer_ctl(Jitter->packets, JITTER_BUFFER_GET_AVALIABLE_COUNT, &count);</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><span class="Apple-tab-span" style="white-space:pre">        </span>return count;<br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">}</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><span class="Apple-style-span" style="font-size: 14px; ">so I wouldnt use the speex_jitter_get(..) unless it had 1 or more packets, but would this ruin the ticking? </span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><span class="Apple-style-span" style="font-size: 14px; ">Another reason for using this method is that I need to detect which client is saying anything as I want to merge the streams (after decode ofc). I have not exactly found out how yet, but Im considering -3db gain per stream (any hints would be appreciated =) ). If I were to use the speex_jitter_get(...) it would require checking the entire frame for 0/silence to determine if it should be merged (since there is no feedback, and I do not want to add silent streams because of the -3db gain) and since only 1 person is speaking in like 99% of the time that is a serious waste of CPU time.</span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">I presume that the client that is sending should not keep "ticking" when not sending, does the speex_jitter_get(...) take this into account (this is probably the essential question)? because there is no way for the buffer to know if it stopped sending or if its just dropped packets.</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">e.g.</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">(8000hz, 20ms frame, 160 samples per frame/tick)</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">frame no. - timestamp</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">frame 1 - 160</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">frame 2 - 320</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">frame 3 - 480</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">......</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">frame n - n*160</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">(stopping transmission)</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">......</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">(starting transmission again)</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">frame n+1 - (n+1)*160</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">frame n+2 - (n+2)*160</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">..... etc</span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">Btw. the speex_jitter_buffer.h from the svn/speex/speexclient repository is missing a </span></font></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-family: Calibri, sans-serif; "><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">#ifdef __cplusplus</span></font></div></div></div></span></div></span></div></span></div></span><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">extern "C"</span></font> </div><div apple-content-edited="true"><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><span class="Apple-style-span" style="font-family: Calibri; ">{</span></span></font></div><div apple-content-edited="true"><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">#endif</span></font></div><div apple-content-edited="true"><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">(if intended, then the "<span class="Apple-style-span" style="font-family: Calibri; ">}"</span> define should be removed)</span></font></div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">and the usual license (unless that is intended too)</span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">Best regards</span></font></div><div><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 14px;">Per Lohmann</span></font></div></body></html>