[Speex-dev] Proper use of jitter-buffer "margin" parameter.

Joshua Gargus
Thu, 25 Sep 2008 18:11:44 -0000

Hi,

We've been having mixed success (mostly good) with the jitter-buffer,
and I'm trying to understand what my options are for tuning JB
parameters to our particular use-case.

In what may become a series of emails, my first question is how to
properly set the margin parameter.

I have set up a test harness that allows me to synthesize arbitrary
sequences of puts/gets, so that I can test the results with different
parameters under repeatable (simulated) network conditions.  I started
with the ideal case: 1-1 interleaved puts/gets, to test the hypothesis
that the sound should be perfect (i.e. identical to decoding the sound
directly, without the jitter-buffer in the middle).

The first thing that jumped out at me was that increasing the margin
parameter results in an artifact right at the beginning of the speech.
I tried margin values of 0, 320, 640, and 960 (multiples of 320 because
I'm using the wideband mode)... as the margin increases, so does the
severity/duration of the glitch.  What is the proper way to use the
margin parameter?  Should I ensure that I push in extra data before
doing my first get?  Also, the default value of margin is "1", not
zero.  At first, this made me think that the margin should small
integers such as 1, 2, 3.  Should my values be 1, 321, 641, etc.?  Or what?

Thanks in advance,
Josh