From: <jpg...@us...> - 2007-05-09 15:47:30
|
Revision: 973 http://svn.sourceforge.net/iaxclient/?rev=973&view=rev Author: jpgrayson Date: 2007-05-09 08:47:28 -0700 (Wed, 09 May 2007) Log Message: ----------- Correctly set the ts (timestamp) field in audio and video iax events. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-05-09 15:06:17 UTC (rev 972) +++ trunk/lib/libiax2/src/iax.c 2007-05-09 15:47:28 UTC (rev 973) @@ -1091,11 +1091,11 @@ { fr = iax_frame_new(DIRECTION_OUTGRESS, f->datalen); if ( fr == NULL ) - { - IAXERROR "Out of memory\n"); - return -1; + { + IAXERROR "Out of memory\n"); + return -1; + } } - } /* Copy our prospective frame into our immediate or retransmitted wrapper */ iax_frame_wrap(fr, f); @@ -1655,7 +1655,8 @@ { static int my_lastts = 0; - if ( ntrunk==0 ) my_lastts = calc_timestamp(session, 0, NULL); + if ( ntrunk == 0 ) + my_lastts = calc_timestamp(session, 0, NULL); if ( !session->quelch ) { @@ -2443,13 +2444,15 @@ struct iax_event *e; struct iax_sched *sch; unsigned int ts; - int subclass = uncompress_subclass(fh->csub); + int subclass; int nowts; int updatehistory = 1; ts = ntohl(fh->ts); if (fh->type==AST_FRAME_VIDEO) subclass = uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1); + else + subclass = uncompress_subclass(fh->csub); /* don't run last_ts backwards; i.e. for retransmits and the like */ if (ts > session->last_ts && @@ -2584,6 +2587,7 @@ case AST_FRAME_VOICE: e->etype = IAX_EVENT_VOICE; e->subclass = subclass; + e->ts = ts; session->voiceformat = subclass; if (datalen) { memcpy(e->data, fh->iedata, datalen); @@ -2842,17 +2846,11 @@ break; case AST_FRAME_VIDEO: e->etype = IAX_EVENT_VIDEO; - //e->subclass = subclass; - // Taken from chan_iax in asterisk 1.0.7 - // Prima uguagliavo a: uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1); - // adesso lo faccio all'inizio della funzione - e->subclass = subclass & ~0x1; + e->subclass = subclass; + e->ts = ts; session->videoformat = e->subclass; - //session->voiceformat = -1; - if (datalen) { - memcpy(e->data, fh->iedata, datalen); - e->datalen = datalen; - } + memcpy(e->data, fh->iedata, datalen); + e->datalen = datalen; e = schedule_delivery(e, ts, updatehistory); break; case AST_FRAME_TEXT: @@ -2914,12 +2912,9 @@ /* Some parts taken from iax_miniheader_to_event and from from chan_iax2.c. We must inform Mark Spencer? */ static struct iax_event *iax_videoheader_to_event(struct iax_session *session, - struct ast_iax2_video_hdr *vh, - int datalen) + struct ast_iax2_video_hdr *vh, int datalen) { struct iax_event * e; - unsigned int ts; - int updatehistory = 1; if ( session->videoformat <= 0 ) { @@ -2941,42 +2936,38 @@ e->subclass = session->videoformat | (ntohs(vh->ts) & 0x8000 ? 1 : 0); e->datalen = datalen; memcpy(e->data, vh->data, e->datalen); - ts = (session->last_ts & 0xFFFF8000L) | (ntohs(vh->ts) & 0x7fff); - e->ts = ts; + e->ts = (session->last_ts & 0xFFFF8000L) | (ntohs(vh->ts) & 0x7fff); - return schedule_delivery(e, ts, updatehistory); + return schedule_delivery(e, e->ts, 1); } static struct iax_event *iax_miniheader_to_event(struct iax_session *session, - struct ast_iax2_mini_hdr *mh, - int datalen) + struct ast_iax2_mini_hdr *mh, int datalen) { - struct iax_event *e; - unsigned int ts; - int updatehistory = 1; + struct iax_event * e; + + if ( session->voiceformat <= 0 ) + { + DEBU(G "No last format received on session %d\n", session->callno); + return 0; + } + e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen); - if (e) { - if (session->voiceformat > 0) { - e->etype = IAX_EVENT_VOICE; - e->session = session; - e->subclass = session->voiceformat; - e->datalen = datalen; - if (datalen) { -#ifdef EXTREME_DEBUG - DEBU(G "%d bytes of voice\n", datalen); -#endif - memcpy(e->data, mh->data, datalen); - } - ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); - return schedule_delivery(e, ts, updatehistory); - } else { - DEBU(G "No last format received on session %d\n", session->callno); - free(e); - e = NULL; - } - } else + + if ( !e ) + { DEBU(G "Out of memory\n"); - return e; + return 0; + } + + e->etype = IAX_EVENT_VOICE; + e->session = session; + e->subclass = session->voiceformat; + e->datalen = datalen; + memcpy(e->data, mh->data, datalen); + e->ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); + + return schedule_delivery(e, e->ts, 1); } void iax_destroy(struct iax_session *session) @@ -3078,9 +3069,14 @@ return NULL; } /* We have a full header, process appropriately */ - session = iax_find_session(sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, 1); + session = iax_find_session(sin, + ntohs(fh->scallno) & ~IAX_FLAG_FULL, + ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, 1); if (!session) - session = iax_txcnt_session(fh, len-sizeof(struct ast_iax2_full_hdr), sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS); + session = iax_txcnt_session(fh, + len - sizeof(struct ast_iax2_full_hdr), + sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, + ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS); if (session) return iax_header_to_event(session, fh, len - sizeof(struct ast_iax2_full_hdr), sin); DEBU(G "No session?\n"); @@ -3099,12 +3095,12 @@ if (session) return iax_videoheader_to_event(session, vh, len - sizeof(struct ast_iax2_video_hdr)); - } else - { - // audio frame?? - session = iax_find_session(sin, ntohs(fh->scallno), 0, 0); - if (session) - return iax_miniheader_to_event(session, mh, len - sizeof(struct ast_iax2_mini_hdr)); + } else { + /* audio frame */ + session = iax_find_session(sin, ntohs(fh->scallno), 0, 0); + if (session) + return iax_miniheader_to_event(session, mh, + len - sizeof(struct ast_iax2_mini_hdr)); } DEBU(G "No session?\n"); return NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2007-07-10 21:12:38
|
Revision: 1059 http://svn.sourceforge.net/iaxclient/?rev=1059&view=rev Author: sbalea Date: 2007-07-10 14:12:33 -0700 (Tue, 10 Jul 2007) Log Message: ----------- Code formatting Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-07-10 21:07:09 UTC (rev 1058) +++ trunk/lib/libiax2/src/iax.c 2007-07-10 21:12:33 UTC (rev 1059) @@ -1063,22 +1063,22 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) - /* High two bits are the same on timestamp, or sending on a trunk */ && - ((f->subclass & ~0x01) == pvt->svideoformat) - /* is the same type */ ) - { - /* Force immediate rather than delayed transmission */ - now = 1; - /* Mark that mini-style frame is appropriate */ - sendmini = 1; + if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) + /* High two bits are the same on timestamp, or sending on a trunk */ && + ((f->subclass & ~0x01) == pvt->svideoformat) + /* is the same type */ ) + { + /* Force immediate rather than delayed transmission */ + now = 1; + /* Mark that mini-style frame is appropriate */ + sendmini = 1; } else { /* we want to send a fullframe and be able to retransmit it */ - now = 0; - sendmini = 0; + now = 0; + sendmini = 0; + } } - } /* if requested, force a full frame */ if ( fullframe ) @@ -1186,7 +1186,6 @@ fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_video_hdr); fr->data = vh; fr->retries = -1; - //fprintf(stderr,"VVVVVVVVV Invio in MINI VIDEO FRAME\n"); res = iax_xmit_frame(fr); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2007-07-18 17:55:56
|
Revision: 1069 http://svn.sourceforge.net/iaxclient/?rev=1069&view=rev Author: sbalea Date: 2007-07-18 10:55:57 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Fixed a bug in the code that handles out of order incoming full frames. Take into account sequence number wraparounds Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-07-16 21:20:18 UTC (rev 1068) +++ trunk/lib/libiax2/src/iax.c 2007-07-18 17:55:57 UTC (rev 1069) @@ -2539,7 +2539,12 @@ /* If it's not an ACK packet, it's out of order. */ DEBU(G "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n", session->iseqno, fh->oseqno, fh->type, subclass); - if (session->iseqno > fh->oseqno) + + /* + * Check if session->iseqno > fh->oseqno, accounting for possible wrap around + * This is correct if the two values are not equal (which, in this case, is guaranteed) + */ + if ( (unsigned char)(session->iseqno - fh->oseqno) < 128 ) { /* If we've already seen it, ack it XXX There's a border condition here XXX */ if ((fh->type != AST_FRAME_IAX) || This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2007-07-20 18:27:52
|
Revision: 1073 http://svn.sourceforge.net/iaxclient/?rev=1073&view=rev Author: sbalea Date: 2007-07-20 11:27:54 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Increase initial ping / retransmission time to 100/200 ms This attempts to avoid retransmission of NEW frames in the beginning of the call. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-07-20 14:22:50 UTC (rev 1072) +++ trunk/lib/libiax2/src/iax.c 2007-07-20 18:27:54 UTC (rev 1073) @@ -465,8 +465,8 @@ s->voiceformat = -1; s->svoiceformat = -1; s->videoformat = -1; - /* Default pingtime to 30 ms */ - s->pingtime = 30; + /* Default pingtime to 100 ms -- should cover most decent net connections */ + s->pingtime = 100; /* XXX Not quite right -- make sure it's not in use, but that won't matter unless you've had at least 65k calls. XXX */ s->callno = callnums++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2007-07-30 18:56:43
|
Revision: 1077 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1077&view=rev Author: bcholew Date: 2007-07-30 11:56:46 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Send only one VNAK for any given sequence number - to help prevent VNAK storms. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-07-25 14:39:25 UTC (rev 1076) +++ trunk/lib/libiax2/src/iax.c 2007-07-30 18:56:46 UTC (rev 1077) @@ -192,6 +192,8 @@ unsigned char iseqno; /* Last acknowledged sequence number */ unsigned char aseqno; + /* Last sequence number we VNAKd */ + unsigned char lastvnak; /* Time value that we base our transmission on */ struct timeval offset; /* Time value we base our delivery on */ @@ -473,6 +475,7 @@ if (callnums > 32767) callnums = 1; s->peercallno = 0; + s->lastvnak = -1; s->transferpeer = 0; /* for attended transfer */ s->next = sessions; s->sendto = iax_sendto; @@ -1617,6 +1620,13 @@ static int iax2_vnak(struct iax_session *session) { + /* send vnak just once for a given sequence number */ + if (session->lastvnak == session->iseqno) + { + return 0; + } + + session->lastvnak = session->iseqno; return send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_VNAK, 0, NULL, 0, session->iseqno); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2007-07-30 19:59:49
|
Revision: 1078 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1078&view=rev Author: bcholew Date: 2007-07-30 12:59:50 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Nobody loves me. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-07-30 18:56:46 UTC (rev 1077) +++ trunk/lib/libiax2/src/iax.c 2007-07-30 19:59:50 UTC (rev 1078) @@ -192,8 +192,6 @@ unsigned char iseqno; /* Last acknowledged sequence number */ unsigned char aseqno; - /* Last sequence number we VNAKd */ - unsigned char lastvnak; /* Time value that we base our transmission on */ struct timeval offset; /* Time value we base our delivery on */ @@ -475,7 +473,6 @@ if (callnums > 32767) callnums = 1; s->peercallno = 0; - s->lastvnak = -1; s->transferpeer = 0; /* for attended transfer */ s->next = sessions; s->sendto = iax_sendto; @@ -1620,13 +1617,6 @@ static int iax2_vnak(struct iax_session *session) { - /* send vnak just once for a given sequence number */ - if (session->lastvnak == session->iseqno) - { - return 0; - } - - session->lastvnak = session->iseqno; return send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_VNAK, 0, NULL, 0, session->iseqno); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-08-13 22:41:32
|
Revision: 1080 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1080&view=rev Author: jpgrayson Date: 2007-08-13 15:41:29 -0700 (Mon, 13 Aug 2007) Log Message: ----------- Throttle vnaks on a per-call basis. This helps prevent vnak storms in certain cases. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-07-31 00:48:36 UTC (rev 1079) +++ trunk/lib/libiax2/src/iax.c 2007-08-13 22:41:29 UTC (rev 1080) @@ -192,6 +192,8 @@ unsigned char iseqno; /* Last acknowledged sequence number */ unsigned char aseqno; + /* Last sequence number we VNAKd */ + unsigned char lastvnak; /* Time value that we base our transmission on */ struct timeval offset; /* Time value we base our delivery on */ @@ -473,6 +475,7 @@ if (callnums > 32767) callnums = 1; s->peercallno = 0; + s->lastvnak = -1; s->transferpeer = 0; /* for attended transfer */ s->next = sessions; s->sendto = iax_sendto; @@ -1617,6 +1620,13 @@ static int iax2_vnak(struct iax_session *session) { + /* send vnak just once for a given sequence number */ + if ( (unsigned char)(session->lastvnak - session->iseqno) < 128 ) + { + return 0; + } + + session->lastvnak = session->iseqno; return send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_VNAK, 0, NULL, 0, session->iseqno); } @@ -2184,6 +2194,14 @@ if (cur->peercallno == 0) { cur->peercallno = callno; } + else if ( cur->peercallno != callno ) + { + // print a warning when the callno's don't match + fprintf( stderr, "WARNING: peercallno does not match callno" + ", peercallno => %d, callno => %d, dcallno => %d", + cur->peercallno, callno, dcallno ) ; + return 0 ; + } return 1; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-10-03 19:27:01
|
Revision: 1175 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1175&view=rev Author: jpgrayson Date: 2007-10-03 12:26:45 -0700 (Wed, 03 Oct 2007) Log Message: ----------- Fix change that breaks random call numbers. This accidentally went in in 1156. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-10-03 18:57:53 UTC (rev 1174) +++ trunk/lib/libiax2/src/iax.c 2007-10-03 19:26:45 UTC (rev 1175) @@ -992,9 +992,8 @@ DEBU(G "Started on port %d\n", portno); } - //srand((unsigned int)time(0)); - //callnums = rand() % 32767 + 1; - callnums = 1; + srand((unsigned int)time(0)); + callnums = rand() % 32767 + 1; transfer_id = rand() % 32767 + 1; return portno; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2007-12-03 16:27:35
|
Revision: 1296 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1296&view=rev Author: bcholew Date: 2007-12-03 08:27:40 -0800 (Mon, 03 Dec 2007) Log Message: ----------- Initialize session variable - avoiding possible garbage in calc_timestamp(). Reduce assumptions made in add_ms(), and don't permit tv_usec to exceed 999999. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-03 15:55:43 UTC (rev 1295) +++ trunk/lib/libiax2/src/iax.c 2007-12-03 16:27:40 UTC (rev 1296) @@ -481,6 +481,10 @@ s->sendto = iax_sendto; s->pingid = -1; +#ifdef USE_VOICE_TS_PREDICTION + s->nextpred = 0; +#endif + s->jb = jb_new(); if ( !s->jb ) { @@ -539,13 +543,14 @@ static void add_ms(struct timeval *tv, int ms) { tv->tv_usec += ms * 1000; - if(tv->tv_usec > 1000000) { - tv->tv_usec -= 1000000; - tv->tv_sec++; + if (tv->tv_usec > 999999) { + tv->tv_sec += tv->tv_usec / 1000000; + tv->tv_usec %= 1000000; } - if(tv->tv_usec < 0) { - tv->tv_usec += 1000000; - tv->tv_sec--; + + if (tv->tv_usec < 0) { + tv->tv_sec += (tv->tv_usec / 1000000 - 1); + tv->tv_usec = (tv->tv_usec % 1000000) + 1000000; } } #endif @@ -646,7 +651,7 @@ #ifdef USE_VOICE_TS_PREDICTION /* set next predicted ts based on 8khz samples */ if(voice) - session->nextpred = session->nextpred + f->samples / 8; + session->nextpred += f->samples / 8; #endif return ms; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-05 23:36:55
|
Revision: 1301 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1301&view=rev Author: jpgrayson Date: 2007-12-05 15:36:59 -0800 (Wed, 05 Dec 2007) Log Message: ----------- Use cast to avoid signed/unsigned comparison warnings. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-05 23:36:23 UTC (rev 1300) +++ trunk/lib/libiax2/src/iax.c 2007-12-05 23:36:59 UTC (rev 1301) @@ -3102,7 +3102,7 @@ if (ntohs(fh->scallno) & IAX_FLAG_FULL) { /* Full size header */ - if (len < sizeof(struct ast_iax2_full_hdr)) { + if ((size_t)len < sizeof(struct ast_iax2_full_hdr)) { DEBU(G "Short header received from %s\n", inet_ntoa(sin->sin_addr)); IAXERROR "Short header received from %s\n", inet_ntoa(sin->sin_addr)); return NULL; @@ -3121,7 +3121,7 @@ DEBU(G "No session?\n"); return NULL; } else { - if (len < sizeof(struct ast_iax2_mini_hdr)) { + if ((size_t)len < sizeof(struct ast_iax2_mini_hdr)) { DEBU(G "Short header received from %s\n", inet_ntoa(sin->sin_addr)); IAXERROR "Short header received from %s\n", inet_ntoa(sin->sin_addr)); return NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bc...@us...> - 2007-12-12 22:19:41
|
Revision: 1307 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1307&view=rev Author: bcholew Date: 2007-12-12 14:19:44 -0800 (Wed, 12 Dec 2007) Log Message: ----------- Decrease socket buffer size from 256KB to 128KB. That seems like enough. Help avoid packet loss by increasing socket's output buffer to the same size as it's input buffer. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-12 22:13:49 UTC (rev 1306) +++ trunk/lib/libiax2/src/iax.c 2007-12-12 22:19:44 UTC (rev 1307) @@ -899,7 +899,7 @@ struct sockaddr_in sin; socklen_t sinlen; int flags; - int bufsize = 256 * 1024; + int bufsize = 128 * 1024; if (netfd > -1) { @@ -989,10 +989,18 @@ if (setsockopt(netfd, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, sizeof(bufsize)) < 0) { - DEBU(G "Unable to set buffer size."); - IAXERROR "Unable to set buffer size."); + DEBU(G "Unable to set receive buffer size."); + IAXERROR "Unable to set receive buffer size."); } + /* set send buffer size too */ + if (setsockopt(netfd, SOL_SOCKET, SO_SNDBUF, (char *)&bufsize, + sizeof(bufsize)) < 0) + { + DEBU(G "Unable to set send buffer size."); + IAXERROR "Unable to set send buffer size."); + } + portno = ntohs(sin.sin_port); DEBU(G "Started on port %d\n", portno); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-17 16:09:57
|
Revision: 1309 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1309&view=rev Author: jpgrayson Date: 2007-12-17 08:10:00 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Patch from Lee Howard. http://sourceforge.net/tracker/index.php?func=detail&aid=1850449&group_id=72851&atid=535896 Remove duplicate function definitions. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-14 04:49:05 UTC (rev 1308) +++ trunk/lib/libiax2/src/iax.c 2007-12-17 16:10:00 UTC (rev 1309) @@ -332,22 +332,6 @@ static int transfer_id = 1; /* for attended transfer */ -void iax_set_private(struct iax_session *s, void *ptr) -{ - s->pvt = ptr; -} - -void *iax_get_private(struct iax_session *s) -{ - return s->pvt; -} - -void iax_set_sendto(struct iax_session *s, iax_sendto_t ptr) -{ - s->sendto = ptr; -} - - unsigned int iax_session_get_capability(struct iax_session *s) { return s->capability; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-17 16:14:06
|
Revision: 1310 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1310&view=rev Author: jpgrayson Date: 2007-12-17 08:14:11 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Patch from Lee Howard. http://sourceforge.net/tracker/index.php?func=detail&aid=1850454&group_id=72851&atid=535896 Add libiax api function to enable/disable the jitterbuffer. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-17 16:10:00 UTC (rev 1309) +++ trunk/lib/libiax2/src/iax.c 2007-12-17 16:14:11 UTC (rev 1310) @@ -128,6 +128,9 @@ /* Video frames bypass jitterbuffer */ static int video_bypass_jitterbuffer = 0; +/* To use or not to use the jitterbuffer */ +static int iax_use_jitterbuffer = 1; + /* UDP Socket (file descriptor) */ static int netfd = -1; @@ -249,6 +252,16 @@ debug = 0; } +void iax_enable_jitterbuffer(void) +{ + iax_use_jitterbuffer = 1; +} + +void iax_disable_jitterbuffer(void) +{ + iax_use_jitterbuffer = 0; +} + void iax_set_private(struct iax_session *s, void *ptr) { s->pvt = ptr; @@ -2342,7 +2355,9 @@ /* insert into jitterbuffer */ /* TODO: Perhaps we could act immediately if it's not droppable and late */ - if ( e->etype == IAX_EVENT_VIDEO && video_bypass_jitterbuffer ) + if ( !iax_use_jitterbuffer || + (e->etype == IAX_EVENT_VIDEO && + video_bypass_jitterbuffer) ) { iax_sched_add(e, NULL, NULL, NULL, 0); return NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-19 15:25:09
|
Revision: 1311 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1311&view=rev Author: jpgrayson Date: 2007-12-19 07:25:09 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to fix plaintext authentication. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-17 16:14:11 UTC (rev 1310) +++ trunk/lib/libiax2/src/iax.c 2007-12-19 15:25:09 UTC (rev 1311) @@ -1929,7 +1929,7 @@ convert_reply(realreply, (unsigned char *) reply); iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply); } else { - iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, password); + iax_ie_append_str(&ied, IAX_IE_PASSWORD, password); } return send_command(session, AST_FRAME_IAX, IAX_COMMAND_AUTHREP, 0, ied.buf, ied.pos, -1); } @@ -1954,7 +1954,7 @@ convert_reply(realreply, (unsigned char *) reply); iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply); } else { - iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, password); + iax_ie_append_str(&ied, IAX_IE_PASSWORD, password); } return send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-19 15:27:27
|
Revision: 1312 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1312&view=rev Author: jpgrayson Date: 2007-12-19 07:27:29 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to clarify/fix a bit of md5pass code. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-19 15:25:09 UTC (rev 1311) +++ trunk/lib/libiax2/src/iax.c 2007-12-19 15:27:29 UTC (rev 1312) @@ -1015,7 +1015,7 @@ { int x; for (x=0;x<16;x++) - out += sprintf(out, "%2.2x", (int)in[x]); + sprintf(out + (x << 1), "%2.2x", (int)in[x]); } static unsigned char compress_subclass(int subclass) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-19 15:32:10
|
Revision: 1313 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1313&view=rev Author: jpgrayson Date: 2007-12-19 07:32:10 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to free REGACK sessions. >From tracker report... With libiax2 registrations are handled in an independent session. This way a registration may be maintained during a long call, for example. (A registration is only maintained by REGREQ...REGACK - authenticated calls do not perpetuate a registration.) Once REGACK is received the session is over with, just like after a HANGUP or a REJECT. So the patch attached fixes this. I think that in iaxclient you have a coping mechanism to work around this libiax2 bug (I think by manually destroying the session in iaxclient), but I think that the right thing to do is to fix libiax2. I don't think that the application really should be destroying sessions, anyway. The intelligent library should be smart enough to handle that. The symptoms of the problem is that after a re-registration occurs incoming calls, for example, are not delivered (don't cause a ring) to the client. I suspect that REGREJ also should be handled similarly, but I'm not in a position to test this. Looking at the Asterisk codebase it appears that both REGACK and REGREJ cause the session to be destroyed. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-19 15:27:29 UTC (rev 1312) +++ trunk/lib/libiax2/src/iax.c 2007-12-19 15:32:10 UTC (rev 1313) @@ -1600,6 +1600,7 @@ */ case IAX_EVENT_REJECT: case IAX_EVENT_HANGUP: + case IAX_EVENT_REGACK: /* Destroy this session -- it's no longer valid */ destroy_session(event->session); return event; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-19 15:35:24
|
Revision: 1314 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1314&view=rev Author: jpgrayson Date: 2007-12-19 07:35:27 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to fix libiax2 build on OpenBSD. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-19 15:32:10 UTC (rev 1313) +++ trunk/lib/libiax2/src/iax.c 2007-12-19 15:35:27 UTC (rev 1314) @@ -30,7 +30,6 @@ #include <winsock.h> #include <time.h> #include <stdlib.h> -#include <malloc.h> #include <stdarg.h> #include <stdio.h> #include <limits.h> @@ -76,9 +75,9 @@ #include <arpa/inet.h> #include <time.h> -#ifndef MACOSX +#if !defined(MACOSX) && !defined(__OpenBSD__) #include <malloc.h> -#ifndef SOLARIS +#if !defined(SOLARIS) #include <error.h> #endif #endif @@ -97,7 +96,7 @@ #ifdef MACOSX #define IAX_SOCKOPTS MSG_DONTWAIT #else -#ifdef SOLARIS +#if defined(SOLARIS) || defined(__OpenBSD__) #define IAX_SOCKOPTS MSG_DONTWAIT #else /* Linux and others */ #define IAX_SOCKOPTS MSG_DONTWAIT | MSG_NOSIGNAL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-19 15:42:20
|
Revision: 1316 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1316&view=rev Author: jpgrayson Date: 2007-12-19 07:42:24 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to improve timestamp semantics in libiax2. >From the tracker... I'm attaching a patch that includes various fixes/improvements to timestamping on iax2 frames in libiax2. Namely: 1) If the *next* miniframe will cause the timestamp to wrap then we need to send a full voice frame now (the one previous to the wrap). If we wait until the wrap occurs then we are leaving it up to the PBX to interpret the wrap. 2) e->ts needs to be properly set for all frames, and not just certain ones. 3) When constructing the timestamp be overly cautious about doing it and keep wrapping under check. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-19 15:38:37 UTC (rev 1315) +++ trunk/lib/libiax2/src/iax.c 2007-12-19 15:42:24 UTC (rev 1316) @@ -1051,7 +1051,7 @@ struct iax_frame *fr; int res; int sendmini=0; - unsigned int lastsent; + unsigned int nextpred; unsigned int fts; if (!pvt) @@ -1060,14 +1060,15 @@ return -1; } - /* this must come before the next call to calc_timestamp() since - calc_timestamp() will change lastsent to the returned value */ - lastsent = pvt->lastsent; - /* Calculate actual timestamp */ fts = calc_timestamp(pvt, ts, f); - if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) + /* If the next predicted VOICE timestamp will overflow the 16-bit + portion of the timestamp then we send a full VOICE frame to + keep the 32-bit portion of the timestamp synchronized. */ + nextpred = pvt->nextpred; + + if (((fts & 0xFFFF0000L) == (nextpred & 0xFFFF0000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && (f->frametype == AST_FRAME_VOICE) /* is a voice frame */ && @@ -1083,7 +1084,7 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) + if (((fts & 0xFFFF8000L) == (nextpred & 0xFFFF8000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && ((f->subclass & ~0x01) == pvt->svideoformat) /* is the same type */ ) @@ -2497,7 +2498,7 @@ /* don't run last_ts backwards; i.e. for retransmits and the like */ if (ts > session->last_ts && - (fh->type == AST_FRAME_IAX && + ((fh->type == AST_FRAME_IAX || fh->type == AST_FRAME_VOICE) && subclass != IAX_COMMAND_ACK && subclass != IAX_COMMAND_PONG && subclass != IAX_COMMAND_LAGRP)) @@ -2621,6 +2622,7 @@ */ e->etype = -1; e->session = session; + e->ts = ts; switch(fh->type) { case AST_FRAME_DTMF: e->etype = IAX_EVENT_DTMF; @@ -2633,7 +2635,6 @@ case AST_FRAME_VOICE: e->etype = IAX_EVENT_VOICE; e->subclass = subclass; - e->ts = ts; session->voiceformat = subclass; if (datalen) { memcpy(e->data, fh->iedata, datalen); @@ -2714,17 +2715,14 @@ case IAX_COMMAND_LAGRQ: /* Pass this along for later handling */ e->etype = IAX_EVENT_LAGRQ; - e->ts = ts; e = schedule_delivery(e, ts, updatehistory); break; case IAX_COMMAND_POKE: e->etype = IAX_EVENT_POKE; - e->ts = ts; break; case IAX_COMMAND_PING: /* PINGS and PONGS don't get scheduled; */ e->etype = IAX_EVENT_PING; - e->ts = ts; break; case IAX_COMMAND_PONG: e->etype = IAX_EVENT_PONG; @@ -2893,7 +2891,6 @@ case AST_FRAME_VIDEO: e->etype = IAX_EVENT_VIDEO; e->subclass = subclass; - e->ts = ts; session->videoformat = e->subclass; memcpy(e->data, fh->iedata, datalen); e->datalen = datalen; @@ -3011,7 +3008,8 @@ e->subclass = session->voiceformat; e->datalen = datalen; memcpy(e->data, mh->data, datalen); - e->ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); + e->ts = (session->last_ts & 0xFFFF0000L) | (ntohs(mh->ts) & 0xFFFF); + e->ts = unwrap_timestamp(e->ts, session->last_ts); return schedule_delivery(e, e->ts, 1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-19 15:55:17
|
Revision: 1317 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1317&view=rev Author: jpgrayson Date: 2007-12-19 07:55:20 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Apply patch from Lee Howard to be able to disable debugging when it is compiled in. I also touched up the whitespace for these touches. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-19 15:42:24 UTC (rev 1316) +++ trunk/lib/libiax2/src/iax.c 2007-12-19 15:55:20 UTC (rev 1317) @@ -826,17 +826,21 @@ { int res; #ifdef DEBUG_SUPPORT - struct ast_iax2_full_hdr *h = (struct ast_iax2_full_hdr *)(f->data); + if (debug) { + struct ast_iax2_full_hdr *h = (struct ast_iax2_full_hdr *)f->data; - if (ntohs(h->scallno) & IAX_FLAG_FULL) - iax_showframe(f, NULL, 0, f->transfer ? - &(f->session->transfer) : - &(f->session->peeraddr), - f->datalen - sizeof(struct ast_iax2_full_hdr)); + if (ntohs(h->scallno) & IAX_FLAG_FULL) + iax_showframe(f, NULL, 0, f->transfer ? + &(f->session->transfer) : + &(f->session->peeraddr), + f->datalen - + sizeof(struct ast_iax2_full_hdr)); + } #endif /* Send the frame raw */ - res = f->session->sendto(netfd, (const char *) f->data, f->datalen, IAX_SOCKOPTS, - f->transfer ? (struct sockaddr *)&(f->session->transfer) : + res = f->session->sendto(netfd, (const char *) f->data, f->datalen, + IAX_SOCKOPTS, f->transfer ? + (struct sockaddr *)&(f->session->transfer) : (struct sockaddr *)&(f->session->peeraddr), sizeof(f->session->peeraddr)); return res; @@ -2507,7 +2511,8 @@ } #ifdef DEBUG_SUPPORT - iax_showframe(NULL, fh, 1, sin, datalen); + if (debug) + iax_showframe(NULL, fh, 1, sin, datalen); #endif /* Get things going with it, timestamp wise, if we This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-20 17:44:19
|
Revision: 1323 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1323&view=rev Author: jpgrayson Date: 2007-12-20 09:44:24 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Fix preprocessor barf. "define" --> "defined". Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-20 15:27:27 UTC (rev 1322) +++ trunk/lib/libiax2/src/iax.c 2007-12-20 17:44:24 UTC (rev 1323) @@ -284,7 +284,7 @@ srandomdev(); #elif defined(HAVE_SRANDOM) srandom((unsigned int)time(0)); -#elif define(HAVE_SRAND48) +#elif defined(HAVE_SRAND48) srand48((long int)time(0)); #else srand((unsigned int)time(0)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2007-12-21 15:52:05
|
Revision: 1327 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1327&view=rev Author: jpgrayson Date: 2007-12-21 07:52:10 -0800 (Fri, 21 Dec 2007) Log Message: ----------- Revert changeset 1313. This change caused REGACK events to implictly destroy the iax_session. This lead to iaxclient double-destroying that session (aka crashing). Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2007-12-21 14:54:16 UTC (rev 1326) +++ trunk/lib/libiax2/src/iax.c 2007-12-21 15:52:10 UTC (rev 1327) @@ -1629,7 +1629,6 @@ */ case IAX_EVENT_REJECT: case IAX_EVENT_HANGUP: - case IAX_EVENT_REGACK: /* Destroy this session -- it's no longer valid */ destroy_session(event->session); return event; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-01-29 22:58:36
|
Revision: 1335 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1335&view=rev Author: sbalea Date: 2008-01-29 14:58:40 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Revert Lee Howard's timestamp changeset (rev 1316) It causes large amounts of video frames to be sent as full IAX2 frames, which is incorrect according to the IAX2 protocol and causes a lot of grief for people running on spotty network connections (grief == VNAK storms) Revision Links: -------------- http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1316&view=rev Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-01-29 21:27:00 UTC (rev 1334) +++ trunk/lib/libiax2/src/iax.c 2008-01-29 22:58:40 UTC (rev 1335) @@ -1070,7 +1070,7 @@ struct iax_frame *fr; int res; int sendmini=0; - unsigned int nextpred; + unsigned int lastsent; unsigned int fts; if (!pvt) @@ -1079,15 +1079,14 @@ return -1; } + /* this must come before the next call to calc_timestamp() since + calc_timestamp() will change lastsent to the returned value */ + lastsent = pvt->lastsent; + /* Calculate actual timestamp */ fts = calc_timestamp(pvt, ts, f); - /* If the next predicted VOICE timestamp will overflow the 16-bit - portion of the timestamp then we send a full VOICE frame to - keep the 32-bit portion of the timestamp synchronized. */ - nextpred = pvt->nextpred; - - if (((fts & 0xFFFF0000L) == (nextpred & 0xFFFF0000L)) + if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && (f->frametype == AST_FRAME_VOICE) /* is a voice frame */ && @@ -1103,7 +1102,7 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (nextpred & 0xFFFF8000L)) + if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && ((f->subclass & ~0x01) == pvt->svideoformat) /* is the same type */ ) @@ -2571,7 +2570,7 @@ /* don't run last_ts backwards; i.e. for retransmits and the like */ if (ts > session->last_ts && - ((fh->type == AST_FRAME_IAX || fh->type == AST_FRAME_VOICE) && + (fh->type == AST_FRAME_IAX && subclass != IAX_COMMAND_ACK && subclass != IAX_COMMAND_PONG && subclass != IAX_COMMAND_LAGRP)) @@ -2696,7 +2695,6 @@ */ e->etype = -1; e->session = session; - e->ts = ts; switch(fh->type) { case AST_FRAME_DTMF: e->etype = IAX_EVENT_DTMF; @@ -2709,6 +2707,7 @@ case AST_FRAME_VOICE: e->etype = IAX_EVENT_VOICE; e->subclass = subclass; + e->ts = ts; session->voiceformat = subclass; if (datalen) { memcpy(e->data, fh->iedata, datalen); @@ -2789,14 +2788,17 @@ case IAX_COMMAND_LAGRQ: /* Pass this along for later handling */ e->etype = IAX_EVENT_LAGRQ; + e->ts = ts; e = schedule_delivery(e, ts, updatehistory); break; case IAX_COMMAND_POKE: e->etype = IAX_EVENT_POKE; + e->ts = ts; break; case IAX_COMMAND_PING: /* PINGS and PONGS don't get scheduled; */ e->etype = IAX_EVENT_PING; + e->ts = ts; break; case IAX_COMMAND_PONG: e->etype = IAX_EVENT_PONG; @@ -2965,6 +2967,7 @@ case AST_FRAME_VIDEO: e->etype = IAX_EVENT_VIDEO; e->subclass = subclass; + e->ts = ts; session->videoformat = e->subclass; memcpy(e->data, fh->iedata, datalen); e->datalen = datalen; @@ -3082,8 +3085,7 @@ e->subclass = session->voiceformat; e->datalen = datalen; memcpy(e->data, mh->data, datalen); - e->ts = (session->last_ts & 0xFFFF0000L) | (ntohs(mh->ts) & 0xFFFF); - e->ts = unwrap_timestamp(e->ts, session->last_ts); + e->ts = (session->last_ts & 0xFFFF0000) | ntohs(mh->ts); return schedule_delivery(e, e->ts, 1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-02-04 22:50:26
|
Revision: 1339 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1339&view=rev Author: sbalea Date: 2008-02-04 14:50:20 -0800 (Mon, 04 Feb 2008) Log Message: ----------- Full video frames should be sent whenever the 15 bits video timestamp rolls over Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-02-01 16:19:08 UTC (rev 1338) +++ trunk/lib/libiax2/src/iax.c 2008-02-04 22:50:20 UTC (rev 1339) @@ -167,6 +167,8 @@ unsigned int last_ts; /* Last transmitted timestamp */ unsigned int lastsent; + /* Timestamp of the last transmitted video frame */ + unsigned int lastvsent; #ifdef USE_VOICE_TS_PREDICTION /* Next predicted voice ts */ unsigned int nextpred; @@ -641,10 +643,7 @@ if(ms <= session->lastsent) ms = session->lastsent + 3; #endif - } else if (video) { - if ((unsigned int)ms <= session->lastsent) - ms = session->lastsent + 3; - } else { + } else if ( !video ) { /* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinking) if appropriate unless it's a genuine frame */ if (genuine) { @@ -1102,7 +1101,7 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (lastsent & 0xFFFF8000L)) + if (((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) /* High two bits are the same on timestamp, or sending on a trunk */ && ((f->subclass & ~0x01) == pvt->svideoformat) /* is the same type */ ) @@ -1117,6 +1116,7 @@ now = 0; sendmini = 0; } + pvt->lastvsent = fts; } /* if requested, force a full frame */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sb...@us...> - 2008-02-05 20:29:35
|
Revision: 1340 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1340&view=rev Author: sbalea Date: 2008-02-05 12:29:40 -0800 (Tue, 05 Feb 2008) Log Message: ----------- Make sure that the video timestamps don't run backwards Code cleanups and comments Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-02-04 22:50:20 UTC (rev 1339) +++ trunk/lib/libiax2/src/iax.c 2008-02-05 20:29:40 UTC (rev 1340) @@ -473,11 +473,10 @@ struct iax_session *iax_session_new(void) { struct iax_session *s; - s = (struct iax_session *)malloc(sizeof(struct iax_session)); + s = calloc(1, sizeof(struct iax_session)); if (s) { jb_conf jbconf; - memset(s, 0, sizeof(struct iax_session)); /* Initialize important fields */ s->voiceformat = -1; s->svoiceformat = -1; @@ -643,7 +642,18 @@ if(ms <= session->lastsent) ms = session->lastsent + 3; #endif - } else if ( !video ) { + } else if ( video ) { + /* + * IAX2 draft 03 says that timestamps MUST be in order. + * It does not say anything about several frames having the same timestamp + * When transporting video, we can have a frame that spans multiple iax packets + * (so called slices), so it would make sense to use the same timestamp for all of + * them + * We do want to make sure that frames don't go backwards though + */ + if ( (unsigned int)ms < session->lastsent ) + ms = session->lastsent; + } else { /* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinking) if appropriate unless it's a genuine frame */ if (genuine) { @@ -1101,14 +1111,13 @@ /* Bitmask taken from chan_iax2.c... I must ask Mark Spencer for this? I think not... */ if ( f->frametype == AST_FRAME_VIDEO ) { - if (((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) - /* High two bits are the same on timestamp, or sending on a trunk */ && - ((f->subclass & ~0x01) == pvt->svideoformat) - /* is the same type */ ) + /* Check if the timestamp has rolled over or if the video codec has changed */ + if ( ((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) && + (f->subclass == pvt->svideoformat) + ) { - /* Force immediate rather than delayed transmission */ + /* send a mini video frame immediately */ now = 1; - /* Mark that mini-style frame is appropriate */ sendmini = 1; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpg...@us...> - 2008-04-15 22:18:06
|
Revision: 1406 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1406&view=rev Author: jpgrayson Date: 2008-04-15 15:18:13 -0700 (Tue, 15 Apr 2008) Log Message: ----------- Whitespace. Modified Paths: -------------- trunk/lib/libiax2/src/iax.c Modified: trunk/lib/libiax2/src/iax.c =================================================================== --- trunk/lib/libiax2/src/iax.c 2008-04-15 22:17:47 UTC (rev 1405) +++ trunk/lib/libiax2/src/iax.c 2008-04-15 22:18:13 UTC (rev 1406) @@ -857,9 +857,9 @@ if (ntohs(h->scallno) & IAX_FLAG_FULL) iax_showframe(f, NULL, 0, f->transfer ? - &(f->session->transfer) : - &(f->session->peeraddr), - f->datalen - sizeof(struct ast_iax2_full_hdr)); + &(f->session->transfer) : + &(f->session->peeraddr), + f->datalen - sizeof(struct ast_iax2_full_hdr)); } #endif /* Send the frame raw */ @@ -1425,7 +1425,6 @@ int transfer_id = 1 + (int)(32767.0 * (iax_random() / (RAND_MAX + 1.0))); memset(&ied0, 0, sizeof(ied0)); - memset(&ied1, 0, sizeof(ied1)); /* reversed setup */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |