diff --git a/include/re_jbuf.h b/include/re_jbuf.h index 902924c18..77ad1961e 100644 --- a/include/re_jbuf.h +++ b/include/re_jbuf.h @@ -37,3 +37,4 @@ void jbuf_flush(struct jbuf *jb); int jbuf_stats(const struct jbuf *jb, struct jbuf_stat *jstat); int jbuf_debug(struct re_printf *pf, const struct jbuf *jb); uint32_t jbuf_packets(const struct jbuf *jb); +uint32_t jbuf_frames(const struct jbuf *jb); diff --git a/src/jbuf/jbuf.c b/src/jbuf/jbuf.c index 5d705c01b..6666d356d 100644 --- a/src/jbuf/jbuf.c +++ b/src/jbuf/jbuf.c @@ -732,6 +732,26 @@ uint32_t jbuf_packets(const struct jbuf *jb) } +/** + * Get number of current frames + * + * @param jb Jitter buffer + * + * @return number of frames + */ +uint32_t jbuf_frames(const struct jbuf *jb) +{ + if (!jb) + return 0; + + mtx_lock(jb->lock); + uint32_t n = jb->nf; + mtx_unlock(jb->lock); + + return n; +} + + /** * Get jitter buffer statistics *