[asterisk-dev] Question about audiohook.c and re-sampling

Joshua Colp jcolp at digium.com
Mon Jun 9 07:23:37 CDT 2014


Dennis Guse wrote:
> Hi,

Kia ora,

> AST_AUDIOHOOK_MANIPULATE_ALL_RATES
> <http://doxygen.asterisk.org/trunk/d0/d79/audiohook_8h.html#015c8ec4d6538b316b6297279134d87fdb150b4fd16c62ba0820d6b2c4b609f0>works
> like charm, e.g. the data is correctly handed over to Jack and comes
> back even for 16Khz.
>
> So only one issue to go...
> I have one last issue with regard to the frames that are written back
> from Jack to Asterisk.
>
> For incoming data from Jack a new frame is created for
> * 8000Hz with data[160] (used at the moment)
> * 16000 Hz with data[320] etc.
>
> Is there a function available to determine the data-length for a frame
> of a certain format, e.g. SLINxx?
> Am I wrong to assume that the following calculation works for the
>   SLIN-family?
> sampling_rate / (1 / ptime)

There is no function, but you can look in bridges/bridge_softmix.c and 
use SOFTMIX_DATALEN and SOFTMIX_SAMPLES. There is also the 
ast_format_rate function which returns the rate of a format.

Cheers,

-- 
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list