From 583cffee1c9586bb588b62bd923a1ee8072e9d32 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Wed, 20 Sep 2023 13:47:11 +0200 Subject: [PATCH] jbuf: simplify rdiff computation --- src/jbuf/jbuf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/jbuf/jbuf.c b/src/jbuf/jbuf.c index 08bf2ef81..d7c824fd8 100644 --- a/src/jbuf/jbuf.c +++ b/src/jbuf/jbuf.c @@ -329,9 +329,7 @@ static void calc_rdiff(struct jbuf *jb, uint16_t seq) rdiff = (int16_t)(jb->seq_put + 1 - seq); adiff = abs(rdiff * JBUF_RDIFF_EMA_COEFF); - s = adiff > jb->rdiff ? JBUF_RDIFF_UP_SPEED : - jb->wish > 2 ? 1 : - jb->wish > 1 ? 2 : 3; + s = adiff > jb->rdiff ? JBUF_RDIFF_UP_SPEED : 1; jb->rdiff += (adiff - jb->rdiff) * s / JBUF_RDIFF_EMA_COEFF; wish = (uint32_t)(jb->rdiff / (float)JBUF_RDIFF_EMA_COEFF);