[Speex-dev] The generic Jitter Buffer and its use

Marian Kechlibar marian.kechlibar at circletech.net
Wed Dec 2 07:50:50 PST 2009

Hello all,

I am currently investigating the JitterBuffer struct provided in the
Speex library, and I am actually thinking about using it with two
different codecs: namely, Speex-NB and AMR-NB. From looking at the code,
it seems that JitterBuffer is capable of working for any codec. Both
Speex-NB and AMR-NB (and probably also other narrowband codecs) produce
20 ms frames and the sampling frequency is 8000 Hz (is that right?). So,
the timestamp of arriving audio frames will be in multiples of 160.

If a frame (or more frames) arrives from the remote side inside a RTP
packet, I invoke jitter_buffer_put() successively on the received
frames, right?

If my audio output stream runs out of data and requires new frame to
play, I invoke jitter_buffer_get(), right?

The questions that I have are:
- what does the method jitter_buffer_get() return when it has no frame?
JITTER_BUFFER_MISSING? In this case, should I say "no data" to the audio
output stream?
- what does it mean when jitter_buffer_get() returns
JITTER_BUFFER_INSERTION? The comment "/** A "fake" packet is meant to be
inserted here to increase buffering */" is not particularly clear to me.
- how do I determine the initial size of the jitter buffer?
- how does the jitter buffer resize itself during its operation?
- can this jitter buffer be used with DTX? Both AMR-NB and Speex-NB
support VAD, which is a huge bonus on low-bandwidth network; so I would
like to be able to use DTX.

Thank you in advance for your patience.

(And, btw, if someone felt like commenting on my previous mail with Re:
SpeexBits, I would be grateful for that too).

Marian Kechlibar

More information about the Speex-dev mailing list