From 6290130011b9e84cd658e4da4fc68744f77d29d5 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Mon, 15 May 2017 18:11:31 -0500 Subject: [PATCH] FS-10319: fix build errors from rtp ts changes --- src/switch_rtp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 408bb57f47..092684f90f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1522,7 +1522,7 @@ static uint8_t get_next_write_ts(switch_rtp_t *rtp_session, uint32_t timestamp) rtp_session->ts = (uint32_t) timestamp; changed++; /* Send marker bit if timestamp is lower/same as before (resetted/new timer) */ - if (abs(rtp_session->ts - rtp_session->last_write_ts) > rtp_session->samples_per_interval + if (abs((int32_t)(rtp_session->ts - rtp_session->last_write_ts)) > rtp_session->samples_per_interval && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) { m++; } @@ -1961,11 +1961,12 @@ static int rtcp_stats(switch_rtp_t *rtp_session) stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->write_timer.samplecount); #endif /* Interarrival jitter calculation */ - pkt_tsdiff = abs((int)rtp_session->write_timer.samplecount - (int)ntohl(hdr->ts)); /* relative transit times for this packet */ + pkt_tsdiff = abs((int32_t)(rtp_session->write_timer.samplecount - ntohl(hdr->ts))); /* relative transit times for this packet */ if (stats->pkt_count < 2) { /* Can not compute Jitter with only one packet */ stats->last_pkt_tsdiff = pkt_tsdiff; } else { - packet_spacing_diff = abs((int)pkt_tsdiff - (int)stats->last_pkt_tsdiff); /* Jitter : difference of relative transit times for the two packets */ + /* Jitter : difference of relative transit times for the two packets */ + packet_spacing_diff = abs((int32_t)(pkt_tsdiff - stats->last_pkt_tsdiff)); stats->last_pkt_tsdiff = pkt_tsdiff; /* Interarrival jitter estimation, "J(i) = J(i-1) + ( |D(i-1,i)| - J(i-1) )/16" */ stats->inter_jitter = (stats->inter_jitter + (((double)packet_spacing_diff - stats->inter_jitter) /16.)); @@ -8024,9 +8025,9 @@ static int rtp_common_write(switch_rtp_t *rtp_session, this_ts = ntohl(send_msg->header.ts); - ts_delta = this_ts - rtp_session->last_write_ts; + ts_delta = abs((int32_t)(this_ts - rtp_session->last_write_ts)); - if (abs(ts_delta) > rtp_session->samples_per_second * 2) { + if (ts_delta > rtp_session->samples_per_second * 2) { rtp_session->flags[SWITCH_RTP_FLAG_RESET] = 1; } #ifdef DEBUG_TS_ROLLOVER