aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2013-05-22 12:18:45 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2013-05-22 12:21:29 +0200
commit92b9a4c6a29580e669e278299fc0ceea1f42be7f (patch)
treeb2d89b0c41254672e67913944961aa65b0880ca7 /src
parent90d4407b6495cf61e3c34b6109a7339afa06e7c6 (diff)
rtp: fix wrong time arithmetics in osmo_rtp_build
rtp.c:154:26: warning: The left operand to '/' is always 0 frame_diff = (usec_diff / 20000); ~~~~~~~~~ ^ rtp.c:157:43: warning: The left operand to '-' is always 0 long int frame_diff_excess = frame_diff - 1; ~~~~~~~~~~ ^ rtp.c:153:39: warning: The right operand to '+' is always 0 usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec; ^ ~~~~~~~~~~~~~~~ rtp.c:153:29: warning: The left operand to '*' is always 0 usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec; ~~~~~~~~~~~~~~ ^ 4 warnings generated. Reported by Holger Hans Peter Freyther.
Diffstat (limited to 'src')
-rw-r--r--src/rtp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rtp.c b/src/rtp.c
index 6245194..2a6ba54 100644
--- a/src/rtp.c
+++ b/src/rtp.c
@@ -143,11 +143,11 @@ osmo_rtp_build(struct osmo_rtp_handle *h, uint8_t payload_type,
{
struct msgb *msg;
struct rtp_hdr *rtph;
- struct timeval tv, tv_diff = {};
+ struct timeval tv, tv_diff;
long int usec_diff, frame_diff;
gettimeofday(&tv, NULL);
- timersub(&tv_diff, &h->tx.last_tv, &tv);
+ timersub(&tv, &h->tx.last_tv, &tv_diff);
h->tx.last_tv = tv;
usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec;