From 836b32fe57b1e4b0807be8dac30163aecb45fbbf Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Thu, 28 Sep 2023 13:51:02 +0200 Subject: [PATCH] jbuf: add again flag for audio --- src/jbuf/jbuf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jbuf/jbuf.c b/src/jbuf/jbuf.c index 5844d6bc8..9e4550ef5 100644 --- a/src/jbuf/jbuf.c +++ b/src/jbuf/jbuf.c @@ -80,6 +80,7 @@ struct jbuf { bool running; /**< Jitter buffer is running */ struct tmr tmr; /**< Timer for EAGAIN */ bool wait; /**< Wait flag for jbuf_get() */ + bool again; /**< Again flag for jbuf_get() */ mtx_t *lock; /**< Makes jitter buffer thread safe */ enum jbuf_type jbtype; /**< Jitter buffer type */ @@ -409,7 +410,8 @@ static void reset_wait(void *arg) { struct jbuf *jb = arg; - jb->wait = false; + jb->wait = false; + jb->again = true; } @@ -612,8 +614,10 @@ int jbuf_get(struct jbuf *jb, struct rtp_header *hdr, void **mem) if (jbuf_frame_ready(jb)) { p = jb->packetl.head->data; - if (p->hdr.ts == hdr->ts) + if (p->hdr.ts == hdr->ts || jb->again) { err = EAGAIN; + jb->again = false; + } else eagain_later(jb); }