\doxysection{Themyscira Wireless RTP jitter buffer implementation}
\label{group__twjit}\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}


The present twjit layer is an interface mechanism from an incoming RTP stream to an output application that has fixed timing requirements, e.\+g., the Tx side of GSM Um TCH or a T1/\+E1 TDM interface.  


\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+twjit\+\_\+stats}
\begin{DoxyCompactList}\small\item\em Stats collected during the lifetime of a twjit instance. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+twjit\+\_\+rr\+\_\+info}
\begin{DoxyCompactList}\small\item\em Info collected from the incoming RTP data stream for the purpose of generating RTCP reception report blocks. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct osmo\+\_\+twjit\+\_\+config $\ast$ \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+alloc} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em \textbackslash{}addgroup twjit \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+free} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf)
\begin{DoxyCompactList}\small\item\em Free a twjit config instance. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+buffer\+\_\+depth} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf, uint16\+\_\+t bd\+\_\+start, uint16\+\_\+t bd\+\_\+hiwat)
\begin{DoxyCompactList}\small\item\em Non-\/vty function for buffer-\/depth setting. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+thinning\+\_\+int} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf, uint16\+\_\+t thinning\+\_\+int)
\begin{DoxyCompactList}\small\item\em Non-\/vty function for thinning-\/interval setting. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+max\+\_\+future\+\_\+sec} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf, uint16\+\_\+t max\+\_\+future\+\_\+sec)
\begin{DoxyCompactList}\small\item\em Non-\/vty function for max-\/future-\/sec setting. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+start\+\_\+min\+\_\+delta} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf, uint16\+\_\+t delta\+\_\+ms)
\begin{DoxyCompactList}\small\item\em Non-\/vty function for start-\/min-\/delta setting. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+start\+\_\+max\+\_\+delta} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf, uint16\+\_\+t delta\+\_\+ms)
\begin{DoxyCompactList}\small\item\em Non-\/vty function for start-\/max-\/delta setting. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+underrun\+\_\+ext} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf, uint16\+\_\+t underrun\+\_\+ext)
\begin{DoxyCompactList}\small\item\em Non-\/vty function for underrun-\/extension setting. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+handover\+\_\+on\+\_\+marker} (struct osmo\+\_\+twjit\+\_\+config $\ast$conf, bool hom)
\begin{DoxyCompactList}\small\item\em Non-\/vty function for marker-\/handling setting. \end{DoxyCompactList}\item 
struct osmo\+\_\+twjit $\ast$ \textbf{ osmo\+\_\+twjit\+\_\+create} (void $\ast$ctx, uint16\+\_\+t clock\+\_\+khz, uint16\+\_\+t quantum\+\_\+ms, const struct osmo\+\_\+twjit\+\_\+config $\ast$config)
\begin{DoxyCompactList}\small\item\em \textbackslash{}addgroup twjit \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+twjit\+\_\+destroy} (struct osmo\+\_\+twjit $\ast$twjit)
\begin{DoxyCompactList}\small\item\em Destroy a twjit instance. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+twjit\+\_\+set\+\_\+config} (struct osmo\+\_\+twjit $\ast$twjit, const struct osmo\+\_\+twjit\+\_\+config $\ast$config)
\begin{DoxyCompactList}\small\item\em Change twjit config parameters. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+twjit\+\_\+reset} (struct osmo\+\_\+twjit $\ast$twjit)
\begin{DoxyCompactList}\small\item\em Reset twjit instance to empty initial state. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+twjit\+\_\+input} (struct osmo\+\_\+twjit $\ast$twjit, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Feed received RTP packet to twjit. \end{DoxyCompactList}\item 
struct msgb $\ast$ \textbf{ osmo\+\_\+twjit\+\_\+output} (struct osmo\+\_\+twjit $\ast$twjit)
\begin{DoxyCompactList}\small\item\em Fixed-\/timing output poll from twjit buffer. \end{DoxyCompactList}\item 
const struct \textbf{ osmo\+\_\+twjit\+\_\+stats} $\ast$ \textbf{ osmo\+\_\+twjit\+\_\+get\+\_\+stats} (struct osmo\+\_\+twjit $\ast$twjit)
\begin{DoxyCompactList}\small\item\em Retrieve lifetime stats from twjit instance. \end{DoxyCompactList}\item 
const struct \textbf{ osmo\+\_\+twjit\+\_\+rr\+\_\+info} $\ast$ \textbf{ osmo\+\_\+twjit\+\_\+get\+\_\+rr\+\_\+info} (struct osmo\+\_\+twjit $\ast$twjit)
\begin{DoxyCompactList}\small\item\em Retrieve RR info from twjit instance. \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+twjit\+\_\+rr\+\_\+info\+\_\+valid} (struct osmo\+\_\+twjit $\ast$twjit)
\begin{DoxyCompactList}\small\item\em Did this twjit instance ever receive RTP input? \end{DoxyCompactList}\item 
\mbox{\label{group__twjit_gaae4fbda9c8e8a7871755b30cc8fd1181}} 
void {\bfseries osmo\+\_\+twjit\+\_\+vty\+\_\+init} (int twjit\+\_\+node)
\item 
int \textbf{ osmo\+\_\+twjit\+\_\+config\+\_\+write} (struct vty $\ast$vty, const struct osmo\+\_\+twjit\+\_\+config $\ast$conf, const char $\ast$prefix)
\begin{DoxyCompactList}\small\item\em Write out vty form of twjit config structure. \end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__twjit_ga05b54d7fc8a4c987448eaa4e7b4da330}} 
{\bfseries DEFUN} (cfg\+\_\+buffer\+\_\+depth, cfg\+\_\+buffer\+\_\+depth\+\_\+cmd, \char`\"{}buffer-\/depth $<$1-\/65535$>$ $<$1-\/65535$>$\char`\"{}, \char`\"{}Buffer depth configuration\textbackslash{}n\char`\"{} \char`\"{}Minimum fill required to start flow\textbackslash{}n\char`\"{} \char`\"{}High water mark fill level\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_ga712966144e689a43c8e496da04917729}} 
{\bfseries DEFUN} (cfg\+\_\+thinning, cfg\+\_\+thinning\+\_\+cmd, \char`\"{}thinning-\/interval $<$2-\/65535$>$\char`\"{}, \char`\"{}Standing queue thinning configuration\textbackslash{}n\char`\"{} \char`\"{}Drop every Nth packet\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_ga779bd7c3055fef6d1090946c03e090ab}} 
{\bfseries DEFUN} (cfg\+\_\+max\+\_\+future, cfg\+\_\+max\+\_\+future\+\_\+cmd, \char`\"{}max-\/future-\/sec $<$1-\/65535$>$\char`\"{}, \char`\"{}Guard against time traveler packets\textbackslash{}n\char`\"{} \char`\"{}Maximum permissible number of seconds into the future\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_ga20516d85cb9662bbf79ba08739cdec9c}} 
{\bfseries DEFUN} (cfg\+\_\+start\+\_\+min\+\_\+delta, cfg\+\_\+start\+\_\+min\+\_\+delta\+\_\+cmd, \char`\"{}start-\/min-\/delta $<$1-\/65535$>$\char`\"{}, \char`\"{}Minimum required delta in time-\/of-\/arrival to start flow\textbackslash{}n\char`\"{} \char`\"{}Time delta value in ms\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_ga375a98a60a3268e8e0ea0c6f7fc4de39}} 
{\bfseries DEFUN} (cfg\+\_\+no\+\_\+start\+\_\+min\+\_\+delta, cfg\+\_\+no\+\_\+start\+\_\+min\+\_\+delta\+\_\+cmd, \char`\"{}no start-\/min-\/delta\char`\"{}, NO\+\_\+\+STR \char`\"{}Minimum required delta in time-\/of-\/arrival to start flow\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_gaa533712534075904bc0eda1cc8d199ae}} 
{\bfseries DEFUN} (cfg\+\_\+start\+\_\+max\+\_\+delta, cfg\+\_\+start\+\_\+max\+\_\+delta\+\_\+cmd, \char`\"{}start-\/max-\/delta $<$1-\/65535$>$\char`\"{}, \char`\"{}Maximum permitted gap in time-\/of-\/arrival in starting state\textbackslash{}n\char`\"{} \char`\"{}Time delta value in ms\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_ga65f07f738211b6349eb28f777607990c}} 
{\bfseries DEFUN} (cfg\+\_\+no\+\_\+start\+\_\+max\+\_\+delta, cfg\+\_\+no\+\_\+start\+\_\+max\+\_\+delta\+\_\+cmd, \char`\"{}no start-\/max-\/delta\char`\"{}, NO\+\_\+\+STR \char`\"{}Maximum permitted gap in time-\/of-\/arrival in starting state\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_ga0f8624dab700a133503dc7b14cdff321}} 
{\bfseries DEFUN} (cfg\+\_\+underrun\+\_\+ext, cfg\+\_\+underrun\+\_\+ext\+\_\+cmd, \char`\"{}underrun-\/extension $<$1-\/65535$>$\char`\"{}, \char`\"{}Underrun extension for intentional gaps (DTX)\textbackslash{}n\char`\"{} \char`\"{}Maximum number of consecutive omitted packets\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_ga180e646a5e53f6c2c088723eb6a74775}} 
{\bfseries DEFUN} (cfg\+\_\+no\+\_\+underrun\+\_\+ext, cfg\+\_\+no\+\_\+underrun\+\_\+ext\+\_\+cmd, \char`\"{}no underrun-\/extension\char`\"{}, NO\+\_\+\+STR \char`\"{}Underrun extension for intentional gaps\textbackslash{}n\char`\"{})
\item 
\mbox{\label{group__twjit_gad2e7294fa8fa609aa9869ce85c3fba4b}} 
{\bfseries DEFUN} (cfg\+\_\+marker\+\_\+handling, cfg\+\_\+marker\+\_\+handling\+\_\+cmd, \char`\"{}marker-\/handling (handover$\vert$ignore)\char`\"{}, \char`\"{}How to handle RTP packets with marker bit set\textbackslash{}n\char`\"{} \char`\"{}Invoke handover handling, same as SSRC change\textbackslash{}n\char`\"{} \char`\"{}Ignore marker bit\textbackslash{}n\char`\"{})
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
The present twjit layer is an interface mechanism from an incoming RTP stream to an output application that has fixed timing requirements, e.\+g., the Tx side of GSM Um TCH or a T1/\+E1 TDM interface. 

For a more detailed description, please consult the full twrtp guide document that can be found in doc/twrtp directory. This document is required reading for anyone seeking to properly understand the present jitter buffer facility, its domain of application and how to use it. Specific section references to this document will be made in subsequent comments. 

\doxysubsection{Function Documentation}
\mbox{\label{group__twjit_ga259b383e11fc673da0e931a806c20f91}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_alloc@{osmo\_twjit\_config\_alloc}}
\index{osmo\_twjit\_config\_alloc@{osmo\_twjit\_config\_alloc}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_alloc()}
{\footnotesize\ttfamily struct osmo\+\_\+twjit\+\_\+config $\ast$ osmo\+\_\+twjit\+\_\+config\+\_\+alloc (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



\textbackslash{}addgroup twjit 

Allocate and initialize twjit config structure


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & Parent talloc context under which struct osmo\+\_\+twjit\+\_\+config should be allocated. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to the newly created twjit config instance, or NULL on errors.
\end{DoxyReturn}
A typical application will have a struct osmo\+\_\+twjit\+\_\+config somewhere in the application config data structures, editable via vty. More complex applications may even have several such twjit config structures, to be used in different contexts such as GSM vs PSTN. However, in the present Osmocom-\/integrated version of twjit, this config structure has been made opaque for ABI reasons -\/ hence config instances now have to be allocated by the library, rather than merely initialized in content. \mbox{\label{group__twjit_gaeaa7314c9ee2efbdce688cc13b63b463}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_free@{osmo\_twjit\_config\_free}}
\index{osmo\_twjit\_config\_free@{osmo\_twjit\_config\_free}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_free()}
{\footnotesize\ttfamily void osmo\+\_\+twjit\+\_\+config\+\_\+free (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf }\end{DoxyParamCaption})}



Free a twjit config instance. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & Instance to be freed \\
\hline
\end{DoxyParams}
\mbox{\label{group__twjit_ga4e56a380bf9751aaf6f6fc323c747c2c}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_set\_buffer\_depth@{osmo\_twjit\_config\_set\_buffer\_depth}}
\index{osmo\_twjit\_config\_set\_buffer\_depth@{osmo\_twjit\_config\_set\_buffer\_depth}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_set\_buffer\_depth()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+buffer\+\_\+depth (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{uint16\+\_\+t}]{bd\+\_\+start,  }\item[{uint16\+\_\+t}]{bd\+\_\+hiwat }\end{DoxyParamCaption})}



Non-\/vty function for buffer-\/depth setting. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & twjit config instance to operate on. \\
\hline
\mbox{\texttt{ in}}  & {\em bd\+\_\+start} & Flow-\/starting fill level, document section 2.\+3.\+3. \\
\hline
\mbox{\texttt{ in}}  & {\em bd\+\_\+hiwat} & High water mark fill level, document section 2.\+3.\+4.\+2. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors. 
\end{DoxyReturn}
\mbox{\label{group__twjit_ga63204cb283949fd8c4417142616f6591}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_set\_handover\_on\_marker@{osmo\_twjit\_config\_set\_handover\_on\_marker}}
\index{osmo\_twjit\_config\_set\_handover\_on\_marker@{osmo\_twjit\_config\_set\_handover\_on\_marker}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_set\_handover\_on\_marker()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+handover\+\_\+on\+\_\+marker (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{bool}]{hom }\end{DoxyParamCaption})}



Non-\/vty function for marker-\/handling setting. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & twjit config instance to operate on. \\
\hline
\mbox{\texttt{ in}}  & {\em hom} & Handover on marker if true, ignore marker bit if false. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors. 
\end{DoxyReturn}
\mbox{\label{group__twjit_ga55d8b223908b5a638ec62983fcfc7706}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_set\_max\_future\_sec@{osmo\_twjit\_config\_set\_max\_future\_sec}}
\index{osmo\_twjit\_config\_set\_max\_future\_sec@{osmo\_twjit\_config\_set\_max\_future\_sec}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_set\_max\_future\_sec()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+max\+\_\+future\+\_\+sec (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{uint16\+\_\+t}]{max\+\_\+future\+\_\+sec }\end{DoxyParamCaption})}



Non-\/vty function for max-\/future-\/sec setting. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & twjit config instance to operate on. \\
\hline
\mbox{\texttt{ in}}  & {\em max\+\_\+future\+\_\+sec} & Maximum number of seconds into the future, document section 2.\+3.\+4.\+3. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors. 
\end{DoxyReturn}
\mbox{\label{group__twjit_ga260c4ebd28ed8592c4b04fc9cadc2935}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_set\_start\_max\_delta@{osmo\_twjit\_config\_set\_start\_max\_delta}}
\index{osmo\_twjit\_config\_set\_start\_max\_delta@{osmo\_twjit\_config\_set\_start\_max\_delta}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_set\_start\_max\_delta()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+start\+\_\+max\+\_\+delta (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{uint16\+\_\+t}]{delta\+\_\+ms }\end{DoxyParamCaption})}



Non-\/vty function for start-\/max-\/delta setting. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & twjit config instance to operate on. \\
\hline
\mbox{\texttt{ in}}  & {\em delta\+\_\+ms} & Maximum permitted ToA gap in ms, or 0 to disable this check; document section 2.\+3.\+3.\+2. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors. 
\end{DoxyReturn}
\mbox{\label{group__twjit_ga8df47e86d7ead591db87da21c73e8dda}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_set\_start\_min\_delta@{osmo\_twjit\_config\_set\_start\_min\_delta}}
\index{osmo\_twjit\_config\_set\_start\_min\_delta@{osmo\_twjit\_config\_set\_start\_min\_delta}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_set\_start\_min\_delta()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+start\+\_\+min\+\_\+delta (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{uint16\+\_\+t}]{delta\+\_\+ms }\end{DoxyParamCaption})}



Non-\/vty function for start-\/min-\/delta setting. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & twjit config instance to operate on. \\
\hline
\mbox{\texttt{ in}}  & {\em delta\+\_\+ms} & Minimum required ToA delta in ms, or 0 to disable this check; document section 2.\+3.\+3.\+2. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors. 
\end{DoxyReturn}
\mbox{\label{group__twjit_ga8c272a9f3344a110dce9e6d66d505493}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_set\_thinning\_int@{osmo\_twjit\_config\_set\_thinning\_int}}
\index{osmo\_twjit\_config\_set\_thinning\_int@{osmo\_twjit\_config\_set\_thinning\_int}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_set\_thinning\_int()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+thinning\+\_\+int (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{uint16\+\_\+t}]{thinning\+\_\+int }\end{DoxyParamCaption})}



Non-\/vty function for thinning-\/interval setting. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & twjit config instance to operate on. \\
\hline
\mbox{\texttt{ in}}  & {\em thinning\+\_\+int} & Thinning interval setting, document section 2.\+3.\+4.\+2. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors. 
\end{DoxyReturn}
\mbox{\label{group__twjit_gaa4ddf8936080ae65f0afb1c50060c281}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_set\_underrun\_ext@{osmo\_twjit\_config\_set\_underrun\_ext}}
\index{osmo\_twjit\_config\_set\_underrun\_ext@{osmo\_twjit\_config\_set\_underrun\_ext}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_set\_underrun\_ext()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+set\+\_\+underrun\+\_\+ext (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{uint16\+\_\+t}]{underrun\+\_\+ext }\end{DoxyParamCaption})}



Non-\/vty function for underrun-\/extension setting. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conf} & twjit config instance to operate on. \\
\hline
\mbox{\texttt{ in}}  & {\em underrun\+\_\+ext} & Maximum permissible intentional gap, in packets, or 0 to disable this mechanism. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors. 
\end{DoxyReturn}
\mbox{\label{group__twjit_gaec23d0393bcf6a30efc503e167afff1b}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_config\_write@{osmo\_twjit\_config\_write}}
\index{osmo\_twjit\_config\_write@{osmo\_twjit\_config\_write}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_config\_write()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+config\+\_\+write (\begin{DoxyParamCaption}\item[{struct vty $\ast$}]{vty,  }\item[{const struct osmo\+\_\+twjit\+\_\+config $\ast$}]{conf,  }\item[{const char $\ast$}]{prefix }\end{DoxyParamCaption})}



Write out vty form of twjit config structure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em vty} & The vty instance to which vty\+\_\+out() calls should be made \\
\hline
\mbox{\texttt{ in}}  & {\em conf} & The config structure to write out \\
\hline
\mbox{\texttt{ in}}  & {\em prefix} & Additional indent prefix to be prepended to each output line, defaults to \char`\"{}\char`\"{} if NULL \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
CMD\+\_\+\+SUCCESS for vty system 
\end{DoxyReturn}
\mbox{\label{group__twjit_ga77a05c62c2cc131b4ca8a00cf8ecca62}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_create@{osmo\_twjit\_create}}
\index{osmo\_twjit\_create@{osmo\_twjit\_create}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_create()}
{\footnotesize\ttfamily struct osmo\+\_\+twjit $\ast$ osmo\+\_\+twjit\+\_\+create (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{uint16\+\_\+t}]{clock\+\_\+khz,  }\item[{uint16\+\_\+t}]{quantum\+\_\+ms,  }\item[{const struct osmo\+\_\+twjit\+\_\+config $\ast$}]{config }\end{DoxyParamCaption})}



\textbackslash{}addgroup twjit 

Create a twjit instance


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & Parent talloc context under which struct osmo\+\_\+twjit should be allocated. \\
\hline
\mbox{\texttt{ in}}  & {\em clock\+\_\+khz} & RTP clock rate in k\+Hz, i.\+e., number of RTP timestamp units per millisecond. The most common value is 8. \\
\hline
\mbox{\texttt{ in}}  & {\em quantum\+\_\+ms} & Duration of a single quantum (unit of speech or data carried in one RTP packet) in milliseconds. The most common value is 20. \\
\hline
\mbox{\texttt{ in}}  & {\em config} & Set of tunable configuration parameters to be used. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to the newly created twjit instance, or NULL on errors.
\end{DoxyReturn}
In contrast to the original twrtp-\/proto version, this version of \doxyref{osmo\+\_\+twjit\+\_\+create()}{p.}{group__twjit_ga77a05c62c2cc131b4ca8a00cf8ecca62} copies the config structure, thus the application is not required to maintain it in the originally passed memory. 

Referenced by \textbf{ osmo\+\_\+twrtp\+\_\+create()}.

\mbox{\label{group__twjit_ga7c28897aed4b25c3ede1a67fc5e6ae95}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_destroy@{osmo\_twjit\_destroy}}
\index{osmo\_twjit\_destroy@{osmo\_twjit\_destroy}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_destroy()}
{\footnotesize\ttfamily void osmo\+\_\+twjit\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit }\end{DoxyParamCaption})}



Destroy a twjit instance. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to be freed\\
\hline
\end{DoxyParams}
Memory freed by this function includes not only the instance structure, but also any msgbs that are held by this instance. 

Referenced by \textbf{ osmo\+\_\+twrtp\+\_\+destroy()}.

\mbox{\label{group__twjit_ga40f81a7ab7af3942e540a50bb367ae56}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_get\_rr\_info@{osmo\_twjit\_get\_rr\_info}}
\index{osmo\_twjit\_get\_rr\_info@{osmo\_twjit\_get\_rr\_info}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_get\_rr\_info()}
{\footnotesize\ttfamily const struct \textbf{ osmo\+\_\+twjit\+\_\+rr\+\_\+info} $\ast$ osmo\+\_\+twjit\+\_\+get\+\_\+rr\+\_\+info (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit }\end{DoxyParamCaption})}



Retrieve RR info from twjit instance. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to query \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to RR info structure
\end{DoxyReturn}
The structure retrieved with this API is called RR info because it contains info that is needed in order to constuct RTCP reception reports describing the RTP stream received by this twjit instance. But of course this info can also be used for other statistics-\/related or monitoring-\/related purposes.

The structure returned by this API is fully valid only if \doxyref{osmo\+\_\+twjit\+\_\+rr\+\_\+info\+\_\+valid()}{p.}{group__twjit_ga7a0b80aa4271d55bbb720a73ab4db421} returns true. If that API returns false, the RR info structure returned by the present API should be considered invalid. More precisely, the \char`\"{}invalid\char`\"{} RR info structure will be all zeros on a freshly created twjit, or stale info if this twjit received some RTP input prior to being reset. There may be some applications that retrieve the RR info structure to report some non-\/critical stats; such uses are allowed even when this structure is invalid in the strict sense. \mbox{\label{group__twjit_gaeb5d008cacb7d8329c0f0fffb4463504}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_get\_stats@{osmo\_twjit\_get\_stats}}
\index{osmo\_twjit\_get\_stats@{osmo\_twjit\_get\_stats}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_get\_stats()}
{\footnotesize\ttfamily const struct \textbf{ osmo\+\_\+twjit\+\_\+stats} $\ast$ osmo\+\_\+twjit\+\_\+get\+\_\+stats (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit }\end{DoxyParamCaption})}



Retrieve lifetime stats from twjit instance. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to query \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to lifetime stats structure 
\end{DoxyReturn}
\mbox{\label{group__twjit_gaf3383fd56f33f86d21aa41afe318c064}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_input@{osmo\_twjit\_input}}
\index{osmo\_twjit\_input@{osmo\_twjit\_input}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_input()}
{\footnotesize\ttfamily void osmo\+\_\+twjit\+\_\+input (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Feed received RTP packet to twjit. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to which input is being fed \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & Message buffer containing the received packet\\
\hline
\end{DoxyParams}
The msgb fed to this API is always consumed by the called function\+: if it isn\textquotesingle{}t freed for being invalid or too old, it is queued to be regurgitated some time later on the output side. The design of twjit assumes that this API will be called as soon as each incoming RTP packet is received from the IP network, without any additional delays; in most applications, thus function will be called by twrtp layer from osmo\+\_\+io Rx callback path. \mbox{\label{group__twjit_gaad365cac430364b862957f46eaaca391}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_output@{osmo\_twjit\_output}}
\index{osmo\_twjit\_output@{osmo\_twjit\_output}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_output()}
{\footnotesize\ttfamily struct msgb $\ast$ osmo\+\_\+twjit\+\_\+output (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit }\end{DoxyParamCaption})}



Fixed-\/timing output poll from twjit buffer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to poll \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pointer to msgb holding a previously received RTP packet that was successfully mapped to the present quantum in the fixed-\/timing output, or NULL if no such packet is available. 
\end{DoxyReturn}


Referenced by \textbf{ osmo\+\_\+twrtp\+\_\+twjit\+\_\+rx\+\_\+poll()}.

\mbox{\label{group__twjit_ga76bed8e0f9d9a23d8d6fea1d8b62abbf}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_reset@{osmo\_twjit\_reset}}
\index{osmo\_twjit\_reset@{osmo\_twjit\_reset}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_reset()}
{\footnotesize\ttfamily void osmo\+\_\+twjit\+\_\+reset (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit }\end{DoxyParamCaption})}



Reset twjit instance to empty initial state. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to be reset\\
\hline
\end{DoxyParams}
This reset function is intended to be called when the application stops doing regular (once every time quantum) reads from the jitter buffer, but may resume this activity later. All packet Rx state and queues are cleared, but \char`\"{}lifetime\char`\"{} statistical counters are NOT reset. 

Referenced by \textbf{ osmo\+\_\+twrtp\+\_\+twjit\+\_\+rx\+\_\+ctrl()}.

\mbox{\label{group__twjit_ga7a0b80aa4271d55bbb720a73ab4db421}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_rr\_info\_valid@{osmo\_twjit\_rr\_info\_valid}}
\index{osmo\_twjit\_rr\_info\_valid@{osmo\_twjit\_rr\_info\_valid}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_rr\_info\_valid()}
{\footnotesize\ttfamily bool osmo\+\_\+twjit\+\_\+rr\+\_\+info\+\_\+valid (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit }\end{DoxyParamCaption})}



Did this twjit instance ever receive RTP input? 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to query \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if this twjit instance received RTP input since it was created or last reset, false otherwise. 
\end{DoxyReturn}
\mbox{\label{group__twjit_ga930cda4155d06b50b87fcdc1785e7bec}} 
\index{Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}!osmo\_twjit\_set\_config@{osmo\_twjit\_set\_config}}
\index{osmo\_twjit\_set\_config@{osmo\_twjit\_set\_config}!Themyscira Wireless RTP jitter buffer implementation@{Themyscira Wireless RTP jitter buffer implementation}}
\doxysubsubsection{osmo\_twjit\_set\_config()}
{\footnotesize\ttfamily int osmo\+\_\+twjit\+\_\+set\+\_\+config (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+twjit $\ast$}]{twjit,  }\item[{const struct osmo\+\_\+twjit\+\_\+config $\ast$}]{config }\end{DoxyParamCaption})}



Change twjit config parameters. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em twjit} & Instance to be reconfigured \\
\hline
\mbox{\texttt{ in}}  & {\em config} & Structure with new tuning parameters to be used \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, negative on errors
\end{DoxyReturn}
The intended use for this API is applications that can use one of several different twjit config profiles depending on various conditions, but might not know the correct choice of profile at the time they create the twjit instance -\/ or more likely, the containing twrtp instance. 