Fix timestamp delivery calculation in IAX... Still might be some mess left...

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Mark Spencer 22 years ago
parent b0d28cedf7
commit b690dc13aa

@ -1581,27 +1581,30 @@ static int schedule_delivery(struct iax_frame *fr, int reallydeliver, int update
IAX thread, with iaxsl lock held. */ IAX thread, with iaxsl lock held. */
ms = calc_rxstamp(iaxs[fr->callno]) - fr->ts; ms = calc_rxstamp(iaxs[fr->callno]) - fr->ts;
fr->af.delivery.tv_sec = iaxs[fr->callno]->rxcore.tv_sec;
fr->af.delivery.tv_usec = iaxs[fr->callno]->rxcore.tv_usec;
fr->af.delivery.tv_sec += fr->ts / 1000;
fr->af.delivery.tv_usec += fr->ts % 1000;
if (fr->af.delivery.tv_usec >= 1000000) {
fr->af.delivery.tv_usec -= 1000000;
fr->af.delivery.tv_sec += 1;
}
if (ms > 32767) { if (ms > 32767) {
/* What likely happened here is that our counter has circled but we haven't /* What likely happened here is that our counter has circled but we haven't
gotten the update from the main packet. We'll just pretend that we did, and gotten the update from the main packet. We'll just pretend that we did, and
update the timestamp appropriately. */ update the timestamp appropriately. */
ms -= 65536; ms -= 65536;
fr->ts += 65536;
} }
if (ms < -32768) { if (ms < -32768) {
/* We got this packet out of order. Lets add 65536 to it to bring it into our new /* We got this packet out of order. Lets add 65536 to it to bring it into our new
time frame */ time frame */
ms += 65536; ms += 65536;
fr->ts -= 65536;
} }
fr->af.delivery.tv_sec = iaxs[fr->callno]->rxcore.tv_sec;
fr->af.delivery.tv_usec = iaxs[fr->callno]->rxcore.tv_usec;
fr->af.delivery.tv_sec += fr->ts / 1000;
fr->af.delivery.tv_usec += (fr->ts % 1000) * 1000;
if (fr->af.delivery.tv_usec >= 1000000) {
fr->af.delivery.tv_usec -= 1000000;
fr->af.delivery.tv_sec += 1;
}
/* Rotate our history queue of "lateness". Don't worry about those initial /* Rotate our history queue of "lateness". Don't worry about those initial
zeros because the first entry will always be zero */ zeros because the first entry will always be zero */

Loading…
Cancel
Save