[Asterisk-Users] Codec Voodoo: piece of evidence: probable fix
Rich Adamson
radamson at routers.com
Sun Mar 28 06:37:12 MST 2004
FWIW, the fix below applies to cvs (not Stable). The stable version of this
is very different. Looks like Stable hasn't been updated for some time.
> static unsigned int calc_txstamp(struct ast_rtp *rtp, struct timeval
> *delivery)
> {
> struct timeval now;
> unsigned int ms;
> if (!rtp->txcore.tv_sec && !rtp->txcore.tv_usec) {
> gettimeofday(&rtp->txcore, NULL);
> rtp->txcore.tv_usec -= rtp->txcore.tv_usec % 20000;
> }
> if (delivery && (delivery->tv_sec || delivery->tv_usec)) {
> /* Use previous txcore */
> => ms = (delivery->tv_sec - rtp->txcore.tv_sec) * 1000;
> ms += ((delivery->tv_usec - rtp->txcore.tv_usec) + 500) /
> 1000;
> rtp->txcore.tv_sec = delivery->tv_sec;
> rtp->txcore.tv_usec = delivery->tv_usec;
> } else {
> gettimeofday(&now, NULL);
> ms = (now.tv_sec - rtp->txcore.tv_sec) * 1000;
> => ms += ((now.tv_usec - rtp->txcore.tv_usec) + 500 ) / 1000;
> /* Use what we just got for next time */
> rtp->txcore.tv_sec = now.tv_sec;
> rtp->txcore.tv_usec = now.tv_usec;
> }
> return ms;
> }
>
More information about the asterisk-users
mailing list