Skip to content

Commit

Permalink
jbuf: add jbuf_frames() again
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Sep 29, 2023
1 parent 9a6c8c5 commit b6b1b0b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/re_jbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
20 changes: 20 additions & 0 deletions src/jbuf/jbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit b6b1b0b

Please sign in to comment.