diff --git a/src/rtp/sess.c b/src/rtp/sess.c index 4bec3ef..ee454c1 100644 --- a/src/rtp/sess.c +++ b/src/rtp/sess.c @@ -563,12 +563,12 @@ void rtcp_sess_rx_rtp(struct rtcp_sess *sess, uint16_t seq, uint32_t ts, if (sess->srate_rx) { - uint32_t ts_arrive; + uint64_t ts_arrive; /* Convert from wall-clock time to timestamp units */ - ts_arrive = (uint32_t)(tmr_jiffies()) * sess->srate_rx / 1000; + ts_arrive = tmr_jiffies() * sess->srate_rx / 1000; - source_calc_jitter(mbr->s, ts, ts_arrive); + source_calc_jitter(mbr->s, ts, (uint32_t)ts_arrive); } mbr->s->rtp_rx_bytes += payload_size; diff --git a/src/rtp/source.c b/src/rtp/source.c index 71d32f0..f87f177 100644 --- a/src/rtp/source.c +++ b/src/rtp/source.c @@ -117,10 +117,12 @@ void source_calc_jitter(struct rtp_source *s, uint32_t rtp_ts, const int transit = arrival - rtp_ts; int d = transit - s->transit; - s->transit = transit; - - if (!s->rtp_rx_bytes) + if (!s->transit) { + s->transit = transit; return; + } + + s->transit = transit; if (d < 0) d = -d;