\doxysection{src/jibuf.c File Reference}
\label{jibuf_8c}\index{src/jibuf.c@{src/jibuf.c}}


Osmocom Jitter Buffer helpers.  


{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$inttypes.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/timer.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/netif/amr.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/netif/rtp.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/netif/jibuf.\+h$>$}\newline
{\ttfamily \#include $<$arpa/inet.\+h$>$}\newline
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\label{jibuf_8c_ab5ac139064984962fc39032f24689759} 
\#define {\bfseries SAMPLES\+\_\+\+PER\+\_\+\+PKT}~160
\item 
\label{jibuf_8c_a4b76a0c2859cfd819a343a780070ee2b} 
\#define {\bfseries SAMPLE\+\_\+\+RATE}~8000
\item 
\label{jibuf_8c_ab8733cbd19aa79e877887c282ef4bb82} 
\#define {\bfseries JIBUF\+\_\+\+DEFAULT\+\_\+\+MIN\+\_\+\+DELAY\+\_\+\+MS}~60
\item 
\label{jibuf_8c_a83fc4d5185ca8ff1c8a36ad787773365} 
\#define {\bfseries JIBUF\+\_\+\+DEFAULT\+\_\+\+MAX\+\_\+\+DELAY\+\_\+\+MS}~200
\item 
\label{jibuf_8c_a98f5365acdbe187488dc29d4bf1b2f38} 
\#define {\bfseries JIBUF\+\_\+\+REFERENCE\+\_\+\+TS\+\_\+\+FREQ}~60
\item 
\label{jibuf_8c_a919ae3c1b4ed76e5efe2c0c6e52403f7} 
\#define {\bfseries JIBUF\+\_\+\+BUFFER\+\_\+\+RECALC\+\_\+\+FREQ}~40
\item 
\label{jibuf_8c_a8002117af96e70c6095b090a03db296e} 
\#define {\bfseries JIBUF\+\_\+\+ALLOWED\+\_\+\+PKT\+\_\+\+DROP}~3
\item 
\label{jibuf_8c_a3617ccbb8af0b78b0864f845100b9abb} 
\#define {\bfseries JIBUF\+\_\+\+ALLOWED\+\_\+\+PKT\+\_\+\+CONSECUTIVE\+\_\+\+DROP}~1
\item 
\label{jibuf_8c_ab6b74faca0c45f42852f275276487352} 
\#define {\bfseries JIBUF\+\_\+\+BUFFER\+\_\+\+INC\+\_\+\+STEP}~20
\item 
\label{jibuf_8c_a92faab8b2e1de77527e20fc0394f9561} 
\#define {\bfseries JIBUF\+\_\+\+BUFFER\+\_\+\+DEC\+\_\+\+STEP}~5
\item 
\label{jibuf_8c_a71209ad037c242e1a2ff468a945facf6} 
\#define {\bfseries JIBUF\+\_\+\+SKEW\+\_\+\+WEIGHT}~((double)1/32)
\item 
\label{jibuf_8c_af07d4d998deea1decf33caa52a18ff40} 
\#define {\bfseries JIBUF\+\_\+\+MSGB\+\_\+\+CB}(\+\_\+\+\_\+msgb)~((struct osmo\+\_\+jibuf\+\_\+msgb\+\_\+cb $\ast$)\&((\+\_\+\+\_\+msgb)-\/$>$cb[0]))
\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+jibuf} $\ast$ \textbf{ osmo\+\_\+jibuf\+\_\+alloc} (void $\ast$talloc\+\_\+ctx)
\begin{DoxyCompactList}\small\item\em Allocate a new jitter buffer instance. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+jibuf\+\_\+delete} (struct \textbf{ osmo\+\_\+jibuf} $\ast$jb)
\begin{DoxyCompactList}\small\item\em Destroy a previously allocated jitter buffer instance. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+jibuf\+\_\+enqueue} (struct \textbf{ osmo\+\_\+jibuf} $\ast$jb, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Try to enqueue a packet into the jitter buffer. \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+jibuf\+\_\+empty} (struct \textbf{ osmo\+\_\+jibuf} $\ast$jb)
\begin{DoxyCompactList}\small\item\em Check whether the jitter buffer instance has packets queued or not. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+jibuf\+\_\+set\+\_\+min\+\_\+delay} (struct \textbf{ osmo\+\_\+jibuf} $\ast$jb, uint32\+\_\+t min\+\_\+delay)
\begin{DoxyCompactList}\small\item\em Set minimum buffer size for the jitter buffer. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+jibuf\+\_\+set\+\_\+max\+\_\+delay} (struct \textbf{ osmo\+\_\+jibuf} $\ast$jb, uint32\+\_\+t max\+\_\+delay)
\begin{DoxyCompactList}\small\item\em Set maximum buffer size for the jitter buffer. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+jibuf\+\_\+enable\+\_\+skew\+\_\+compensation} (struct \textbf{ osmo\+\_\+jibuf} $\ast$jb, bool enable)
\begin{DoxyCompactList}\small\item\em Toggle use of skew detection and compensation mechanism. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+jibuf\+\_\+set\+\_\+dequeue\+\_\+cb} (struct \textbf{ osmo\+\_\+jibuf} $\ast$jb, osmo\+\_\+jibuf\+\_\+dequeue\+\_\+cb dequeue\+\_\+cb, void $\ast$cb\+\_\+data)
\begin{DoxyCompactList}\small\item\em Set dequeue callback for the jitter buffer. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Osmocom Jitter Buffer helpers. 

