From e91084bec9a5dea5b37f106e6f1435efd946a110 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 17 Feb 2019 21:16:51 +0100 Subject: [PATCH] rtp: fix calculation of loss fraction --- lib/nodes/rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nodes/rtp.c b/lib/nodes/rtp.c index 922c59a00..2eb3e6dd1 100644 --- a/lib/nodes/rtp.c +++ b/lib/nodes/rtp.c @@ -94,7 +94,7 @@ static int rtp_aimd(struct node *n, double loss_frac) if (!r->rtcp.enabled) return -1; - if (loss_frac < 1e-3) + if (loss_frac < 0.01) rate = r->aimd.last_rate + r->aimd.a; else rate = r->aimd.last_rate * r->aimd.b; @@ -333,7 +333,7 @@ static void rtcp_handler(const struct sa *src, struct rtcp_msg *msg, void *arg) if (msg->hdr.count > 0) { const struct rtcp_rr *rr = &msg->r.sr.rrv[0]; debug(5, "rtp: fraction lost = %d", rr->fraction); - rtp_aimd(n, rr->fraction); + rtp_aimd(n, (double) rr->fraction / 256); } else warning("Received RTCP sender report with zero reception reports");