From 9965630393e09da7937ca1d69626c7684e3be382 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Thu, 28 Sep 2023 17:32:00 +0200 Subject: [PATCH] jbuf: delay buffer shrink after last out-of-order packet --- src/jbuf/jbuf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jbuf/jbuf.c b/src/jbuf/jbuf.c index 9e4550ef5..3325c7a81 100644 --- a/src/jbuf/jbuf.c +++ b/src/jbuf/jbuf.c @@ -38,9 +38,8 @@ #endif enum { - JBUF_RDIFF_EMA_COEFF = 1024, - JBUF_RDIFF_UP_SPEED = 512, JBUF_PUT_TIMEOUT = 400, + JBUF_WAIT_TIMEOUT = 1000, }; @@ -421,7 +420,7 @@ static void eagain_later(struct jbuf *jb) if (tmr_isrunning(&jb->tmr)) return; - tmr_start(&jb->tmr, 250, reset_wait, jb); + tmr_start(&jb->tmr, JBUF_WAIT_TIMEOUT, reset_wait, jb); } @@ -504,6 +503,7 @@ int jbuf_put(struct jbuf *jb, const struct rtp_header *hdr, void *mem) " - inserting after seq=%u (seq=%u)\n", seq_le, seq); list_insert_after(&jb->packetl, le, &p->le, p); + tmr_start(&jb->tmr, JBUF_WAIT_TIMEOUT, reset_wait, jb); break; } else if (seq == seq_le) { /* less likely */ @@ -539,7 +539,7 @@ int jbuf_put(struct jbuf *jb, const struct rtp_header *hdr, void *mem) p->hdr = *hdr; p->mem = mem_ref(mem); if (tail && ((struct packet *)tail->data)->hdr.ts != hdr->ts) { - jb->nf++; + ++jb->nf; jb->wait = false; }