This commit is contained in:
Anthony Minessale 2010-11-11 12:32:29 -06:00
parent 3be3cd762a
commit cd95138427
2 changed files with 5 additions and 4 deletions

View File

@ -78,18 +78,18 @@ extern size_t next_power_of_2(size_t v);
#define CALC_BUFF_LEN(fl, bl) (((fl) >= (bl))? next_power_of_2((fl) << 1): next_power_of_2((bl) << 1))
#define INIT_CIRC_BUFFER(bf, bl, fl) \
#define INIT_CIRC_BUFFER(bf, bl, fl, s) \
{ \
(bf)->buf_len = CALC_BUFF_LEN((fl), (bl)); \
(bf)->mask = (bf)->buf_len - 1; \
(bf)->buf = (BUFF_TYPE *)calloc((bf)->buf_len, sizeof(BUFF_TYPE)); \
(bf)->buf = (BUFF_TYPE *) switch_core_session_alloc(s, (bf)->buf_len * sizeof(BUFF_TYPE)); \
assert((bf)->buf != NULL); \
(bf)->pos = 0; \
(bf)->lpos = 0; \
(bf)->backlog = 0; \
}
#define DESTROY_CIRC_BUFFER(b) free((b)->buf)
//#define DESTROY_CIRC_BUFFER(b) free((b)->buf)
#define GET_BACKLOG_POS(b) ((b)->lpos - (b)->backlog)
#define GET_CURRENT_POS(b) ((b)->lpos)
#define GET_CURRENT_SAMPLE(b) GET_SAMPLE((b), GET_CURRENT_POS((b)))

View File

@ -130,7 +130,7 @@ static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_se
{
/*! This is a worst case sample rate estimate */
avmd_session->rate = 48000;
INIT_CIRC_BUFFER(&avmd_session->b, BEEP_LEN(avmd_session->rate), FRAME_LEN(avmd_session->rate));
INIT_CIRC_BUFFER(&avmd_session->b, BEEP_LEN(avmd_session->rate), FRAME_LEN(avmd_session->rate), fs_session);
avmd_session->session = fs_session;
avmd_session->pos = 0;
@ -176,6 +176,7 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw
case SWITCH_ABC_TYPE_READ_PING:
break;
case SWITCH_ABC_TYPE_CLOSE:
break;
case SWITCH_ABC_TYPE_READ:
break;