[asterisk-dev] understanding ast_codec_get_samples for AMR

Ian Hailey lists at dinplug.com
Tue Nov 21 10:10:45 MST 2006


Hello all,

I am trying to understand why ast_codec_get_samples is needed? It 
returns the calculation of the number of voice samples contained in a 
frame of a given byte length.

This is called from:

chan_iax2.c
res_musiconhold.c
rtp.c

Maybe I missed something but won't all voice frames contain either 0 or 
the pre-defined (negotiated) number of samples? For example an RTP 
packet from a G.711 stream will always contain 160 samples as will a GSM 
packet.

For my AMR implementation I am correct in thinking that this function 
could simply return either 0 or 160 samples (the decoder will always 
produce this many samples)?

I am assuming that the function is called once per speech frame (i.e. 
per time perios e.g. 20ms for GSM, AMR etc.)

Thanks.

Ian.


More information about the asterisk-dev mailing list