From: <do...@us...> - 2008-01-30 16:18:01
|
Revision: 1336 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1336&view=rev Author: dohpaz Date: 2008-01-30 08:18:05 -0800 (Wed, 30 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: -------------- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-29 22:58:40 UTC (rev 1335) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2008-01-30 16:18:05 UTC (rev 1336) @@ -1075,7 +1075,7 @@ struct iax_frame *fr; int res; int sendmini=0; - unsigned int nextpred; + unsigned int lastsent; unsigned int fts; if (!pvt) @@ -1084,15 +1084,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 */ && @@ -1108,7 +1107,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 */ ) @@ -2580,7 +2579,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)) @@ -2705,7 +2704,6 @@ */ e->etype = -1; e->session = session; - e->ts = ts; switch(fh->type) { case AST_FRAME_DTMF: e->etype = IAX_EVENT_DTMF; @@ -2718,6 +2716,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); @@ -2798,14 +2797,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; @@ -2974,6 +2976,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; @@ -3091,8 +3094,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. |