Merge "frame: Better handle interpolated frames."

This commit is contained in:
Jenkins2
2017-04-27 17:29:02 -05:00
committed by Gerrit Code Review
2 changed files with 15 additions and 0 deletions

View File

@@ -945,6 +945,15 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st
if (!(middle_frame = audiohook_list_translate_to_slin(audiohook_list, direction, start_frame))) {
return frame;
}
/* If the translation resulted in an interpolated frame then immediately return as audiohooks
* rely on actual media being present to do things.
*/
if (!middle_frame->data.ptr) {
ast_frfree(middle_frame);
return start_frame;
}
samples = middle_frame->samples;
/*

View File

@@ -442,8 +442,14 @@ struct ast_frame *ast_trans_frameout(struct ast_trans_pvt *pvt,
}
if (datalen) {
f->datalen = datalen;
f->data.ptr = pvt->outbuf.c;
} else {
f->datalen = pvt->datalen;
if (!f->datalen) {
f->data.ptr = NULL;
} else {
f->data.ptr = pvt->outbuf.c;
}
pvt->datalen = 0;
}