Fix a few more places in chan_iax2 where the ast_frame used for receiving a

frame was not properly initialized.
 - Interpolating a frame when the jitterbuffer is in use
 - decrypting a frame when IAX2 encryption is on
 - frames in an IAX2 trunk


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@58705 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Russell Bryant 18 years ago
parent 442c9f222f
commit 8ae4e264d1

@ -2245,18 +2245,15 @@ static void __get_from_jb(void *p)
break;
case JB_INTERP:
{
struct ast_frame af;
struct ast_frame af = { 0, };
/* create an interpolation frame */
af.frametype = AST_FRAME_VOICE;
af.subclass = pvt->voiceformat;
af.datalen = 0;
af.samples = frame.ms * 8;
af.mallocd = 0;
af.src = "IAX2 JB interpolation";
af.data = NULL;
af.delivery = ast_tvadd(pvt->rxcore, ast_samp2tv(next, 1000));
af.offset=AST_FRIENDLY_OFFSET;
af.offset = AST_FRIENDLY_OFFSET;
/* queue the frame: For consistency, we would call __do_deliver here, but __do_deliver wants an iax_frame,
* which we'd need to malloc, and then it would free it. That seems like a drag */
@ -3677,9 +3674,9 @@ static int decode_frame(aes_decrypt_ctx *dcx, struct ast_iax2_full_hdr *fh, stru
{
int padding;
unsigned char *workspace;
workspace = alloca(*datalen);
if (!workspace)
return -1;
memset(f, 0, sizeof(*f));
if (ntohs(fh->scallno) & IAX_FLAG_FULL) {
struct ast_iax2_full_enc_hdr *efh = (struct ast_iax2_full_enc_hdr *)fh;
if (*datalen < 16 + sizeof(struct ast_iax2_full_hdr))
@ -4522,15 +4519,14 @@ static int iax2_write(struct ast_channel *c, struct ast_frame *f)
static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const unsigned char *data, int datalen, int seqno,
int now, int transfer, int final)
{
struct ast_frame f;
struct ast_frame f = { 0, };
f.frametype = type;
f.subclass = command;
f.datalen = datalen;
f.samples = 0;
f.mallocd = 0;
f.offset = 0;
f.src = (char *)__FUNCTION__;
f.data = (char *)data;
f.src = __FUNCTION__;
f.data = (void *) data;
return iax2_send(i, &f, ts, seqno, now, transfer, final);
}
@ -6268,7 +6264,7 @@ static int socket_process(struct iax2_thread *thread)
struct ast_iax2_meta_trunk_mini *mtm;
struct iax_frame *fr;
struct iax_frame *cur;
struct ast_frame f;
struct ast_frame f = { 0, };
struct ast_channel *c;
struct iax2_dpcache *dp;
struct iax2_peer *peer;
@ -6372,6 +6368,7 @@ static int socket_process(struct iax2_thread *thread)
/* If it's a valid call, deliver the contents. If not, we
drop it, since we don't have a scallno to use for an INVAL */
/* Process as a mini frame */
memset(&f, 0, sizeof(f));
f.frametype = AST_FRAME_VOICE;
if (iaxs[fr->callno]) {
if (iaxs[fr->callno]->voiceformat > 0) {
@ -6380,8 +6377,6 @@ static int socket_process(struct iax2_thread *thread)
if (f.datalen >= 0) {
if (f.datalen)
f.data = ptr;
else
f.data = NULL;
if(trunked_ts) {
fr->ts = (iaxs[fr->callno]->last & 0xFFFF0000L) | (trunked_ts & 0xffff);
} else
@ -6390,13 +6385,8 @@ static int socket_process(struct iax2_thread *thread)
if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED)) {
/* Common things */
f.src = "IAX2";
f.mallocd = 0;
f.offset = 0;
if (f.datalen && (f.frametype == AST_FRAME_VOICE))
f.samples = ast_codec_get_samples(&f);
else
f.samples = 0;
fr->outoforder = 0;
iax_frame_wrap(fr, &f);
duped_fr = iaxfrdup2(fr);
if (duped_fr) {

Loading…
Cancel
Save