[asterisk-dev] Re: Help with 240 samples on framesreadfromchan_iax

Dan Austin Dan_Austin at Phoenix.com
Mon Nov 6 19:20:19 MST 2006


Moises wrote:
>   Hum, it seems to work with slinear, ulaw, alaw and gsm, but not 
> with iLBC, it complains about ilbc frame not being multiple of 50,
> so i tried to make it happy, but still misses some translations 
> from slinear to iLBC and the sound is choppy. What makes iLBC so 
> special any way?

Aren't VBR codecs fun?  iLBC has two valid packetization intervals,
20ms and 30ms with the encoding being 33bytes and 50bytes respectively.

The codecs that you have found to work use a consistent encoding
strategy that grows linearly, and thus is easy to setup buffers or
smoothing against.

The code in frame.c handles codecs with linear increases in their
encoded payload just fine.  There is code to deal with the other
VBR codec (speex), but iLBC is currently statically assumed to be
30ms.  Oddly enough that has been the case for some time, even when
the rest of Asterisk assumed all payloads were 20ms.

The logical fix (as far as I can see, and I am quite possibly wrong),
is to impliment a simple function in frame.c along the lines of
speex_samples() for iLBC and call that function from inside
ast_codec_get_samples() which is also in frame.c to set the
proper number of samples.

To be fair, calling iLBC VBR may not be completely accurate, but
I am not sure of a better way to describe it.

Dan





More information about the asterisk-dev mailing list