[asterisk-commits] branch 1.2 r10511 -
/branches/1.2/channels/chan_iax2.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Feb 19 22:54:11 MST 2006
Author: markster
Date: Sun Feb 19 23:54:10 2006
New Revision: 10511
URL: http://svn.digium.com/view/asterisk?rev=10511&view=rev
Log:
Fix numerous places in jitter buffer where freed memory is referenced
Modified:
branches/1.2/channels/chan_iax2.c
Modified: branches/1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_iax2.c?rev=10511&r1=10510&r2=10511&view=diff
==============================================================================
--- branches/1.2/channels/chan_iax2.c (original)
+++ branches/1.2/channels/chan_iax2.c Sun Feb 19 23:54:10 2006
@@ -2240,11 +2240,12 @@
/* while we transition from the old JB to the new one, we can either make two schedule_delivery functions, or
* make preprocessor swiss-cheese out of this one. I'm not sure which is less revolting.. */
-static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtrunk)
+static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtrunk, unsigned int *tsout)
{
#ifdef NEWJB
int type, len;
int ret;
+ int needfree = 0;
#else
int x;
int ms;
@@ -2267,7 +2268,7 @@
/* Attempt to recover wrapped timestamps */
unwrap_timestamp(fr);
-
+
if (updatehistory) {
#ifndef NEWJB
@@ -2365,8 +2366,10 @@
}
if ( (!ast_test_flag(iaxs[fr->callno], IAX_USEJITTERBUF)) ) {
+ if (tsout)
+ *tsout = fr->ts;
__do_deliver(fr);
- return 0;
+ return -1;
}
/* if the user hasn't requested we force the use of the jitterbuffer, and we're bridged to
@@ -2388,8 +2391,10 @@
iaxs[fr->callno]->jbid = -1;
/* deliver this frame now */
+ if (tsout)
+ *tsout = fr->ts;
__do_deliver(fr);
- return 0;
+ return -1;
}
@@ -2399,7 +2404,7 @@
ret = jb_put(iaxs[fr->callno]->jb, fr, type, len, fr->ts,
calc_rxstamp(iaxs[fr->callno],fr->ts));
if (ret == JB_DROP) {
- iax2_frame_free(fr);
+ needfree++;
} else if (ret == JB_SCHED) {
update_jbsched(iaxs[fr->callno]);
}
@@ -2468,13 +2473,15 @@
if ((delay > -4) || (fr->af.frametype != AST_FRAME_VOICE)) {
if (option_debug && iaxdebug)
ast_log(LOG_DEBUG, "schedule_delivery: Delivering immediately (Calculated delay is %d)\n", delay);
+ if (tsout)
+ *tsout = fr->ts;
__do_deliver(fr);
+ return -1;
} else {
if (option_debug && iaxdebug)
ast_log(LOG_DEBUG, "schedule_delivery: Dropping voice packet since %dms delay is too old\n", delay);
iaxs[fr->callno]->frames_dropped++;
- /* Free our iax frame */
- iax2_frame_free(fr);
+ needfree++;
}
} else {
if (option_debug && iaxdebug)
@@ -2482,6 +2489,13 @@
fr->retrans = ast_sched_add(sched, delay, do_deliver, fr);
}
#endif
+ if (tsout)
+ *tsout = fr->ts;
+ if (needfree) {
+ /* Free our iax frame */
+ iax2_frame_free(fr);
+ return -1;
+ }
return 0;
}
@@ -6396,15 +6410,13 @@
} else {
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 1);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 1, &fr.ts);
}
}
#else
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 1);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 1, &fr.ts);
}
#endif
if (iaxs[fr.callno]->last < fr.ts) {
@@ -7591,15 +7603,13 @@
} else {
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 0);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 0, &fr.ts);
}
}
#else
duped_fr = iaxfrdup2(&fr);
if (duped_fr) {
- schedule_delivery(duped_fr, updatehistory, 0);
- fr.ts = duped_fr->ts;
+ schedule_delivery(duped_fr, updatehistory, 0, &fr.ts);
}
#endif
More information about the asterisk-commits
mailing list