aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-04-19 17:20:34 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-14 19:34:31 +0200
commitf28e85d48ff0048500625e6d67232443a0e1cfae (patch)
tree3a107dfe5446dca57c56dd8004d252b5eb9c2046
parent7652418623942f16d6bb6ee6f8133536daa308d6 (diff)
jibuf: Add osmo_jibuf_empty API
This is useful to know if we need to keep iterating over osmo_select_main() to dequeue packets before finishing. Change-Id: I91a23e220c56924b847265c5dc752f286b109c2c
-rw-r--r--include/osmocom/netif/jibuf.h2
-rw-r--r--src/jibuf.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/include/osmocom/netif/jibuf.h b/include/osmocom/netif/jibuf.h
index f472dd5..ffa1f33 100644
--- a/include/osmocom/netif/jibuf.h
+++ b/include/osmocom/netif/jibuf.h
@@ -53,6 +53,8 @@ void osmo_jibuf_delete(struct jibuf *jb);
int osmo_jibuf_enqueue(struct jibuf *jb, struct msgb *msg);
+bool osmo_jibuf_empty(struct jibuf *jb);
+
void osmo_jibuf_set_min_delay(struct jibuf *jb, uint32_t min_delay);
void osmo_jibuf_set_max_delay(struct jibuf *jb, uint32_t max_delay);
diff --git a/src/jibuf.c b/src/jibuf.c
index b439a47..7cb77fa 100644
--- a/src/jibuf.c
+++ b/src/jibuf.c
@@ -349,6 +349,15 @@ int osmo_jibuf_enqueue(struct jibuf *jb, struct msgb *msg)
return 0;
}
+/*! \brief Check whether the jitter buffer instance has packets queued or not.
+ * \param[in] jb jitter buffer instance
+ * \return true if the queue is empty, false otherwise.
+ */
+bool osmo_jibuf_empty(struct jibuf *jb)
+{
+ return llist_empty(&jb->msg_list);
+}
+
/*! \brief Set minimum buffer size for the jitter buffer
* \param[in] jb jitter buffer instance