Merge branch 'master' into multichannel

This commit is contained in:
Tristan Matthews
2013-07-12 14:33:01 -04:00
3 changed files with 18 additions and 27 deletions

View File

@ -564,7 +564,7 @@ static int calc_timestamp(struct iax_session *session, unsigned int ts, struct a
special cases. */
if (ts)
{
if ( f && session )
if ( f )
session->lastsent = ts;
return ts;
}
@ -848,6 +848,7 @@ static int iax_reliable_xmit(struct iax_frame *f)
if (!fc->data) {
DEBU(G "Out of memory\n");
IAXERROR "Out of memory\n");
free(fc);
return -1;
}
memcpy(fc->data, f->data, f->datalen);
@ -876,7 +877,7 @@ int iax_init(int preferredportno)
if (iax_recvfrom == (iax_recvfrom_t)recvfrom)
{
struct sockaddr_in sin;
struct sockaddr_in sin = {};
socklen_t sinlen;
int flags;
int bufsize = 256 * 1024;
@ -1198,7 +1199,7 @@ static int iax_send(struct iax_session *pvt, struct ast_frame *f, unsigned int t
res = iax_xmit_frame(fr);
}
}
if( !now && fr!=NULL )
if( !now )
iax_frame_free( fr );
return res;
}
@ -1989,6 +1990,7 @@ void iax_pref_codec_del(struct iax_session *session, unsigned int format)
char remove = which_bit(format) + diff;
strncpy(old, session->codec_order, sizeof(old));
old[sizeof(old) - 1] = '\0';
session->codec_order_len = 0;
for (x = 0; x < (int) strlen(old); x++) {
@ -2644,6 +2646,7 @@ static struct iax_event *iax_header_to_event(struct iax_session *session, struct
strncpy(session->codec_order,
e->ies.codec_prefs,
sizeof(session->codec_order));
session->codec_order[sizeof(session->codec_order) - 1] = '\0';
session->codec_order_len =
(int)strlen(session->codec_order);
}
@ -3128,7 +3131,7 @@ struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_i
static struct iax_sched *iax_get_sched(struct timeval tv)
{
struct iax_sched *cur, *prev=NULL;
struct iax_sched *cur;
cur = schedq;
/* Check the event schedule first. */
while(cur) {
@ -3136,11 +3139,7 @@ static struct iax_sched *iax_get_sched(struct timeval tv)
((tv.tv_sec == cur->when.tv_sec) &&
(tv.tv_usec >= cur->when.tv_usec))) {
/* Take it out of the event queue */
if (prev) {
prev->next = cur->next;
} else {
schedq = cur->next;
}
schedq = cur->next;
return cur;
}
cur = cur->next;

View File

@ -369,7 +369,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
/* Don't mess with mini-frames */
return;
}
if (fh->type > (int)sizeof(frames)/(int)sizeof(char *)) {
if (fh->type >= (int)sizeof(frames)/(int)sizeof(char *)) {
snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type);
clas = class2;
} else {
@ -386,7 +386,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
subclass = iaxs[(int)fh->csub];
}
} else if (fh->type == AST_FRAME_CONTROL) {
if (fh->csub > (int)sizeof(cmds)/(int)sizeof(char *)) {
if (fh->csub >= (int)sizeof(cmds)/(int)sizeof(char *)) {
snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub);
subclass = subclass2;
} else {

View File

@ -237,8 +237,10 @@ static void history_calc_maxbuf(jitterbuf *jb)
for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
/* found where it fits */
if (toins > jb->hist_maxbuf[j]) {
/* move over */
memmove(jb->hist_maxbuf + j + 1, jb->hist_maxbuf + j, (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_maxbuf[0]));
/* move over if there's space */
const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_maxbuf[0]);
if (slide > 0)
memmove(jb->hist_maxbuf + j + 1, jb->hist_maxbuf + j, slide);
/* insert */
jb->hist_maxbuf[j] = toins;
@ -254,8 +256,10 @@ static void history_calc_maxbuf(jitterbuf *jb)
for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
/* found where it fits */
if (toins < jb->hist_minbuf[j]) {
/* move over */
memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0]));
/* move over if there's space */
const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0]);
if (slide > 0)
memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, slide);
/* insert */
jb->hist_minbuf[j] = toins;
@ -263,18 +267,6 @@ static void history_calc_maxbuf(jitterbuf *jb)
}
}
}
if (0) {
int k;
fprintf(stderr, "toins = %ld\n", toins);
fprintf(stderr, "maxbuf =");
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
fprintf(stderr, "%ld ", jb->hist_maxbuf[k]);
fprintf(stderr, "\nminbuf =");
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
fprintf(stderr, "%ld ", jb->hist_minbuf[k]);
fprintf(stderr, "\n");
}
}
jb->hist_maxbuf_valid = 1;