[svn-commits] russell: branch 1.4 r58705 -
/branches/1.4/channels/chan_iax2.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Sat Mar 10 11:11:12 MST 2007
Author: russell
Date: Sat Mar 10 12:11:11 2007
New Revision: 58705
URL: http://svn.digium.com/view/asterisk?view=rev&rev=58705
Log:
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
Modified:
branches/1.4/channels/chan_iax2.c
Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?view=diff&rev=58705&r1=58704&r2=58705
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Sat Mar 10 12:11:11 2007
@@ -2245,18 +2245,15 @@
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 @@
{
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 __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 @@
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 @@
/* 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 @@
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 @@
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) {
More information about the svn-commits
mailing list