[asterisk-dev] audiohook with G722 codec: wrong number of samples

David Vossel dvossel at digium.com
Wed Apr 28 11:06:48 CDT 2010


----- Original Message -----
> From: "Simon Sester" <sester at ind.rwth-aachen.de>
> To: asterisk-dev at lists.digium.com
> Sent: Wednesday, April 28, 2010 10:40:55 AM
> Subject: [asterisk-dev] audiohook with G722 codec: wrong number of samples

> > I am running Asterisk SVN-branch-1.6.2-r258676.
> >
> > I am developing a module using the audiohook api that modifies the
> > data of frames passed to the manipulate_callback function.
> >
> > The G722 capable phones are connected to Asterisk using SIP.
> >
> > When hooked to a channel (nativeformats = G722) the frame contains
> > the
> > following information:
> > frame->datalen = 320
> > frame->samples = 160
> > frame->len = 20
> > ast_format_rate(chan->nativeformats) = 16000
> >
> > But based on the codec and the reported samplerate I would expect
> > 320
> > samples and a datalength of 640 in a frame of 20ms length:
> > 16000Hz * 20ms * 1s/1000ms = 320 samples
> >
> > Why don't the missing 160 frames reach the audiohook?
> >
> > Thanks,
> > Simon

Simon,

If you are using audiohooks, everything is downgraded to 8khz 16bit signed linear, so if we have 16khz G722 with 320 samples, that will be downgraded to 160 sample 8khz audio for the audiohook manipulation.  This is a limitation that I am not happy with.

David Vossel
Digium, Inc. | Software Developer, Open Source Software
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
The_Boy_Wonder in #asterisk-dev




More information about the asterisk-dev mailing list