static int jb_get_fixed(void *jb, struct ast_frame **fout, long now, long interpl)
{
struct fixed_jb *fixedjb = (struct fixed_jb *) jb;
- struct fixed_jb_frame frame;
+ struct fixed_jb_frame frame = { .data = &ast_null_frame };
int res;
res = fixed_jb_get(fixedjb, &frame, now, interpl);
static int jb_get_adaptive(void *jb, struct ast_frame **fout, long now, long interpl)
{
jitterbuf *adaptivejb = (jitterbuf *) jb;
- jb_frame frame;
+ jb_frame frame = { .data = &ast_null_frame };
int res;
res = jb_get(adaptivejb, &frame, now, interpl);
} else {
res = framedata->jb_impl->put(framedata->jb_obj, jbframe, now);
}
+
if (res == AST_JB_IMPL_OK) {
+ if (jbframe != frame) {
+ ast_frfree(frame);
+ }
frame = &ast_null_frame;
+ } else if (jbframe != frame) {
+ ast_frfree(jbframe);
}
putframe = 1;
}
}
}
+ ast_frfree(frame);
+ frame = &ast_null_frame;
res = framedata->jb_impl->get(framedata->jb_obj, &frame, now, framedata->timer_interval);
switch (res) {
case AST_JB_IMPL_OK:
case AST_JB_IMPL_INTERP:
if (framedata->last_format) {
struct ast_frame tmp = { 0, };
+
tmp.frametype = AST_FRAME_VOICE;
tmp.subclass.format = framedata->last_format;
/* example: 8000hz / (1000 / 20ms) = 160 samples */
tmp.delivery = ast_tvadd(framedata->start_tv, ast_samp2tv(next, 1000));
tmp.offset = AST_FRIENDLY_OFFSET;
tmp.src = "func_jitterbuffer interpolation";
+ ast_frfree(frame);
frame = ast_frdup(&tmp);
break;
}
/* else fall through */
case AST_JB_IMPL_NOFRAME:
+ ast_frfree(frame);
frame = &ast_null_frame;
break;
}