Index: app_jack.c =================================================================== --- app_jack.c (revision 274530) +++ app_jack.c (working copy) @@ -21,6 +21,7 @@ * \brief Jack Application * * \author Russell Bryant + * \author Fabio Torchetti * * This is an application to connect an Asterisk channel to an input * and output jack port so that the audio can be processed through @@ -39,6 +40,10 @@ resample ***/ +#include +#include +#include + #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") @@ -60,19 +65,41 @@ #define RESAMPLE_QUALITY 1 -#define RINGBUFFER_SIZE 16384 +/* The bigger the buffer size is, the more delay will be introduced */ +/* in the conversation. Make sure that you set the period of Jack to */ +/* multiples of 80 (which is 80*4=320 bytes => the frame size of */ +/* asterisk) for better performance and quality. */ +#define RINGBUFFER_SIZE 1280 +/* Asterisk core native rate is 8KHz */ +#define NATIVE_RATE 8000.0 + +/* Number of bytes in a frame sample */ +#define FRAME_SAMPLE_SIZE 4 + +/* The different ringbuffer overrun handling algorithms */ +enum { + RB_UNDEFINED = 0, + RB_DROP, + RB_ALLOCATE, + RB_FLEXIBLE, +}; + /*! \brief Common options between the Jack() app and JACK_HOOK() function */ #define COMMON_OPTIONS \ -" s() - Connect to the specified jack server name.\n" \ -" i() - Connect the output port that gets created to the specified\n" \ -" jack input port.\n" \ -" o() - Connect the input port that gets created to the specified\n" \ -" jack output port.\n" \ -" n - Do not automatically start the JACK server if it is not already\n" \ -" running.\n" \ -" c() - By default, Asterisk will use the channel name for the jack client\n" \ -" name. Use this option to specify a custom client name.\n" +" s() - Connect to the specified jack server name.\n" \ +" r() - Size of the ringbuffer - multiples of 320 will make you happy.\n" \ +" d - Drop ringbuffer when filled [Default].\n" \ +" e - Empty enough ringbuffer when filled.\n" \ +" t() - Empty enough buffer consecutive times then drop it.\n" \ +" i() - Connect the output port that gets created to the specified\n" \ +" jack input port.\n" \ +" o() - Connect the input port that gets created to the specified\n" \ +" jack output port.\n" \ +" n - Do not automatically start the JACK server if it is not already\n" \ +" running.\n" \ +" c() - By default, Asterisk will use the channel name for the jack client\n" \ +" name. Use this option to specify a custom client name.\n" /*** DOCUMENTATION @@ -86,6 +113,37 @@ Connect to the specified jack server name + + + +