diff options
author | Matthew Jordan <mjordan@digium.com> | 2015-03-30 02:45:29 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2015-03-30 02:45:29 +0000 |
commit | 7bc2345fb16fb0ae616d4573cef6f08db54a2ba3 (patch) | |
tree | e53f2520ece32972d9d09f5746b9f6b495df3a8f /channels/chan_iax2.c | |
parent | ce59fabd5c01a48b8f4fcd1d7522aef9f3fbe66d (diff) |
clang compiler warnings: Fix -Wabsolute-value warnings
This patch fixes several warnings caught by clang - in this case, usage of the
abs function on non-integer values. This patch uses labs and fabs, as
appropriate, in the various affected files.
Review: https://reviewboard.asterisk.org/r/4525
ASTERISK-24917
Reported by: dkdegroot
patches:
rb4525.patch submitted by dkdegroot (License 6600)
........
Merged revisions 433749 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 433750 from http://svn.asterisk.org/svn/asterisk/branches/13
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 702a76327..ff45b83fc 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5986,7 +5986,7 @@ static unsigned int calc_txpeerstamp(struct iax2_trunk_peer *tpeer, int sampms, ms = ast_tvdiff_ms(*now, tpeer->txtrunktime); /* Predict from last value */ pred = tpeer->lastsent + sampms; - if (abs(ms - pred) < MAX_TIMESTAMP_SKEW) + if (labs(ms - pred) < MAX_TIMESTAMP_SKEW) ms = pred; /* We never send the same timestamp twice, so fudge a little if we must */ @@ -6059,7 +6059,8 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str ms = 0; if (voice) { /* On a voice frame, use predicted values if appropriate */ - if (p->notsilenttx && abs(ms - p->nextpred) <= MAX_TIMESTAMP_SKEW) { + adjust = (ms - p->nextpred); + if (p->notsilenttx && abs(adjust) <= MAX_TIMESTAMP_SKEW) { /* Adjust our txcore, keeping voice and non-voice synchronized */ /* AN EXPLANATION: When we send voice, we usually send "calculated" timestamps worked out @@ -6078,7 +6079,6 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str changing at all. But if a consistent different starts to develop it will be eliminated over the course of 10 frames (200-300msecs) */ - adjust = (ms - p->nextpred); if (adjust < 0) p->offset = ast_tvsub(p->offset, ast_samp2tv(abs(adjust), 10000)); else if (adjust > 0) @@ -6100,9 +6100,9 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str * silent periods are multiples of * frame size too) */ - if (iaxdebug && abs(ms - p->nextpred) > MAX_TIMESTAMP_SKEW ) + if (iaxdebug && abs(adjust) > MAX_TIMESTAMP_SKEW ) ast_debug(1, "predicted timestamp skew (%d) > max (%d), using real ts instead.\n", - abs(ms - p->nextpred), MAX_TIMESTAMP_SKEW); + abs(adjust), MAX_TIMESTAMP_SKEW); if (f->samples >= rate) /* check to make sure we don't core dump */ { @@ -6128,11 +6128,12 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str } else { /* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinking) if appropriate unless it's a genuine frame */ + adjust = (ms - p->lastsent); if (genuine) { /* genuine (IAX LAGRQ etc) must keep their clock-based stamps */ if (ms <= p->lastsent) ms = p->lastsent + 3; - } else if (abs(ms - p->lastsent) <= MAX_TIMESTAMP_SKEW) { + } else if (abs(adjust) <= MAX_TIMESTAMP_SKEW) { /* non-genuine frames (!?) (DTMF, CONTROL) should be pulled into the predicted stream stamps */ ms = p->lastsent + 3; } |