Index: main/translate.c =================================================================== --- main/translate.c (revision 402137) +++ main/translate.c (working copy) @@ -521,41 +521,40 @@ } out = p->t->frameout(p); } - if (consume) { - ast_frfree(f); - } - if (out == NULL) { - return NULL; - } - /* we have a frame, play with times */ - if (!ast_tvzero(delivery)) { - /* Regenerate prediction after a discontinuity */ - if (ast_tvzero(path->nextout)) { - path->nextout = ast_tvnow(); - } + if (out) { + /* we have a frame, play with times */ + if (!ast_tvzero(delivery)) { + /* Regenerate prediction after a discontinuity */ + if (ast_tvzero(path->nextout)) { + path->nextout = ast_tvnow(); + } - /* Use next predicted outgoing timestamp */ - out->delivery = path->nextout; + /* Use next predicted outgoing timestamp */ + out->delivery = path->nextout; - /* Predict next outgoing timestamp from samples in this - frame. */ - path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, ast_format_rate(&out->subclass.format))); - if (f->samples != out->samples && ast_test_flag(out, AST_FRFLAG_HAS_TIMING_INFO)) { - ast_debug(4, "Sample size different %u vs %u\n", f->samples, out->samples); - ast_clear_flag(out, AST_FRFLAG_HAS_TIMING_INFO); + /* Predict next outgoing timestamp from samples in this + frame. */ + path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, ast_format_rate(&out->subclass.format))); + if (f->samples != out->samples && ast_test_flag(out, AST_FRFLAG_HAS_TIMING_INFO)) { + ast_debug(4, "Sample size different %u vs %u\n", f->samples, out->samples); + ast_clear_flag(out, AST_FRFLAG_HAS_TIMING_INFO); + } + } else { + out->delivery = ast_tv(0, 0); + ast_set2_flag(out, has_timing_info, AST_FRFLAG_HAS_TIMING_INFO); + if (has_timing_info) { + out->ts = ts; + out->len = len; + out->seqno = seqno; + } } - } else { - out->delivery = ast_tv(0, 0); - ast_set2_flag(out, has_timing_info, AST_FRFLAG_HAS_TIMING_INFO); - if (has_timing_info) { - out->ts = ts; - out->len = len; - out->seqno = seqno; + /* Invalidate prediction if we're entering a silence period */ + if (out->frametype == AST_FRAME_CNG) { + path->nextout = ast_tv(0, 0); } } - /* Invalidate prediction if we're entering a silence period */ - if (out->frametype == AST_FRAME_CNG) { - path->nextout = ast_tv(0, 0); + if (consume) { + ast_frfree(f); } return out; }