[Speex-dev] speex_jitter_buffer and DTX (and multiple streams)

Per Lohmann Poulsen per at interactivelabproduction.com
Tue Mar 3 02:59:48 PST 2009


Hi,

I have a few questions about the speex_jitter_buffer when used with  
DTX here goes:

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.

I have 1 x SpeexJitter struct per client stream

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

int buffer_has_data(SpeexJitter* jitter)
{
	int count = 0;
	jitter_buffer_ctl(Jitter->packets, JITTER_BUFFER_GET_AVALIABLE_COUNT,  
&count);
	return count;
}
so I wouldnt use the speex_jitter_get(..) unless it had 1 or more  
packets, but would this ruin the ticking?

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.

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.
e.g.
(8000hz, 20ms frame, 160 samples per frame/tick)
frame no. - timestamp
frame 1  -  160
frame 2  -  320
frame 3  -  480
......
frame n  -  n*160
(stopping transmission)
......
(starting transmission again)
frame n+1  -  (n+1)*160
frame n+2  -  (n+2)*160
..... etc

Btw. the speex_jitter_buffer.h from the svn/speex/speexclient  
repository is missing a
#ifdef __cplusplus
extern "C"
{
#endif
(if intended, then the "}" define should be removed)

and the usual license (unless that is intended too)

Best regards
Per Lohmann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20090303/8c4ba9b5/attachment.htm 


More information about the Speex-dev mailing list