summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2015-03-30 02:44:57 +0000
committerMatthew Jordan <mjordan@digium.com>2015-03-30 02:44:57 +0000
commit5f8faf16af107855e6afa2574b3e9436ed20250c (patch)
treec0f4d512da952404de20faf78a53a68d2843b021 /channels/chan_iax2.c
parent09b681e344b5f40544ae0de8685a4010cba1d21e (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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index e1fbbd10d..eeec1e1f1 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -5999,7 +5999,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 */
@@ -6072,7 +6072,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
@@ -6091,7 +6092,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)
@@ -6113,9 +6113,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 */
{
@@ -6141,11 +6141,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;
}