All pastes #11325 Raw Edit

Mine

public text v1 · immutable
#11325 ·published 2005-05-09 18:42 UTC
rendered paste body
               if (voice) {
                        /* On a voice frame, use predicted values if appropriate */
                        if (p->notsilenttx && abs(ms - p->nextpred) <= MAX_TIMESTAMP_SKEW) {
                                /* Adjust our txcore, keeping voice and
                                        non-voice synchronized */
                                add_ms(&p->offset, (int)(ms - p->nextpred)/10);

                                if (!p->nextpred) {
                                        p->nextpred = ms; /*f->samples / 8;*/
                                        if (p->nextpred <= p->lastsent)
                                                p->nextpred = p->lastsent + 3;
                                }
                                ms = p->nextpred;
                        } else {
                               /* in this case, just use the actual
                                * time, since we're either way off
                                * (shouldn't happen), or we're  ending a
                                * silent period -- and seed the next
                                * predicted time.  Also, round ms to the
                                * next multiple of frame size (so our
                                * silent periods are multiples of
                                * frame size too) */

if(abs(ms - p->nextpred) > MAX_TIMESTAMP_SKEW)
        ast_log(LOG_WARNING,"abs(ms - p->nexpred) is %u, which is > %u\n",abs(ms - p->nextpred), MAX_TIMESTAMP_SKEW);

                                if (f->samples >= 8) /* check to make sure we dont core dump */
                                {
                                        int diff = ms % (f->samples / 8);
                                        if (diff)
                                            ms += f->samples/8 - diff;
                                }