diff -Naur a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c --- a/res/res_rtp_asterisk.c 2015-08-24 11:29:13.000000000 +0200 +++ b/res/res_rtp_asterisk.c 2015-08-24 14:46:07.029134437 +0200 @@ -3130,8 +3130,9 @@ static int ast_rtp_raw_write(struct ast_rtp_instance *instance, struct ast_frame *frame, int codec) { struct ast_rtp *rtp = ast_rtp_instance_get_data(instance); - int pred, mark = 0; + unsigned int pred, mark = 0; unsigned int ms = calc_txstamp(rtp, &frame->delivery); + int diff = 0; struct ast_sockaddr remote_address = { {0,} }; int rate = rtp_get_rate(frame->subclass.format) / 1000; @@ -3148,15 +3149,19 @@ /* Re-calculate last TS */ rtp->lastts = rtp->lastts + ms * rate; + diff = rtp->lastts - pred; + ast_debug(3, "lassts: %u, ms: %u, diff: %d, rate: %d, pred: %u\n", rtp->lastts, ms, diff, rate, pred); if (ast_tvzero(frame->delivery)) { /* If this isn't an absolute delivery time, Check if it is close to our prediction, and if so, go with our prediction */ - if (abs((int)rtp->lastts - pred) < MAX_TIMESTAMP_SKEW) { + if (abs(diff) < MAX_TIMESTAMP_SKEW) { rtp->lastts = pred; } else { ast_debug(3, "Difference is %d, ms is %u\n", abs((int)rtp->lastts - pred), ms); mark = 1; } + } else { + ast_debug(3, "ast_tvzero(frame->delivery) is false\n"); } } else if (frame->frametype == AST_FRAME_VIDEO) { mark = frame->subclass.frame_ending;