libosmo-netif  1.2.0
Osmocom network interface library
jibuf.h File Reference

Osmocom Jitter Buffer helpers. More...

#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include <osmocom/core/timer.h>

Go to the source code of this file.

Data Structures

struct  osmo_jibuf
 A structure representing a single instance of a jitter buffer. More...
 

Typedefs

typedef void(* osmo_jibuf_dequeue_cb) (struct msgb *msg, void *data)
 

Functions

struct osmo_jibufosmo_jibuf_alloc (void *talloc_ctx)
 Allocate a new jitter buffer instance. More...
 
void osmo_jibuf_delete (struct osmo_jibuf *jb)
 Destroy a previously allocated jitter buffer instance. More...
 
int osmo_jibuf_enqueue (struct osmo_jibuf *jb, struct msgb *msg)
 Try to enqueue a packet into the jitter buffer. More...
 
bool osmo_jibuf_empty (struct osmo_jibuf *jb)
 Check whether the jitter buffer instance has packets queued or not. More...
 
void osmo_jibuf_set_min_delay (struct osmo_jibuf *jb, uint32_t min_delay)
 Set minimum buffer size for the jitter buffer. More...
 
void osmo_jibuf_set_max_delay (struct osmo_jibuf *jb, uint32_t max_delay)
 Set maximum buffer size for the jitter buffer. More...
 
void osmo_jibuf_enable_skew_compensation (struct osmo_jibuf *jb, bool enable)
 Toggle use of skew detection and compensation mechanism. More...
 
void osmo_jibuf_set_dequeue_cb (struct osmo_jibuf *jb, osmo_jibuf_dequeue_cb dequeue_cb, void *cb_data)
 Set dequeue callback for the jitter buffer. More...
 

Variables

struct osmo_jibuf __attribute__
 

Detailed Description

Osmocom Jitter Buffer helpers.

osmo_dgram_destroy
void osmo_dgram_destroy(struct osmo_dgram *conn)
Destroy a Osmocom datagram transceiver.
Definition: datagram.c:445
osmux_in_handle
Definition: osmux.h:56
osmo_jibuf_msgb_cb
Definition: jibuf.c:66
osmo_dgram_tx_set_local_port
void osmo_dgram_tx_set_local_port(struct osmo_dgram_tx *conn, uint16_t port)
Set the local port from which we transmit.
Definition: datagram.c:181
osmo_stream_cli_set_connect_cb
void osmo_stream_cli_set_connect_cb(struct osmo_stream_cli *cli, int(*connect_cb)(struct osmo_stream_cli *cli))
Set the call-back function called on connect of the stream client socket.
Definition: stream.c:685
msgb_sctp_stream
#define msgb_sctp_stream(msg)
Access the SCTP Stream ID from the msgb control buffer.
Definition: stream.h:15
osmo_stream_cli_set_addr
void osmo_stream_cli_set_addr(struct osmo_stream_cli *cli, const char *addr)
Set the remote address to which we connect.
Definition: stream.c:496
osmo_stream_cli_set_disconnect_cb
void osmo_stream_cli_set_disconnect_cb(struct osmo_stream_cli *cli, int(*disconnect_cb)(struct osmo_stream_cli *cli))
Set the call-back function called on disconnect of the stream client socket.
Definition: stream.c:694
osmo_stream_cli_set_proto
void osmo_stream_cli_set_proto(struct osmo_stream_cli *cli, uint16_t proto)
Set the protocol for the stream client socket.
Definition: stream.c:588
osmo_stream_srv_link_set_data
void osmo_stream_srv_link_set_data(struct osmo_stream_srv_link *link, void *data)
Set application private data of the stream server link.
Definition: stream.c:1130
osmo_rtp_handle
Definition: rtp.c:37
osmo_dgram_rx_recv
int osmo_dgram_rx_recv(struct osmo_dgram_rx *conn, struct msgb *msg)
Receive data via Osmocom datagram receiver.
Definition: datagram.c:261
osmo_stream_srv_get_data
void * osmo_stream_srv_get_data(struct osmo_stream_srv *conn)
Get application private data of the stream server.
Definition: stream.c:1408
osmo_dgram_tx_set_port
void osmo_dgram_tx_set_port(struct osmo_dgram_tx *conn, uint16_t port)
Set the remote port to which we transmit.
Definition: datagram.c:160
osmo_dgram_set_remote_addr
void osmo_dgram_set_remote_addr(struct osmo_dgram *conn, const char *addr)
Set the remote address to which we transmit/connect.
Definition: datagram.c:464
osmo_dgram_rx_destroy
void osmo_dgram_rx_destroy(struct osmo_dgram_rx *conn)
Destroy the datagram receiver. Releases Memory.
Definition: datagram.c:344
osmo_dgram_tx_set_addr
void osmo_dgram_tx_set_addr(struct osmo_dgram_tx *conn, const char *addr)
Set the remote address to which we transmit.
Definition: datagram.c:149
osmo_jibuf_delete
void osmo_jibuf_delete(struct osmo_jibuf *jb)
Destroy a previously allocated jitter buffer instance.
Definition: jibuf.c:320
osmo_stream_cli_recv
int osmo_stream_cli_recv(struct osmo_stream_cli *conn, struct msgb *msg)
Receive data via an Osmocom stream client.
Definition: stream.c:881
msgb_sctp_ppid
#define msgb_sctp_ppid(msg)
Access the SCTP PPID from the msgb control buffer.
Definition: stream.h:13
osmo_stream_srv
Definition: stream.c:1257
osmo_dgram_tx_close
void osmo_dgram_tx_close(struct osmo_dgram_tx *conn)
Close an Osmocom Datagram Transmitter.
Definition: datagram.c:80
osmo_dgram_rx_set_read_cb
void osmo_dgram_rx_set_read_cb(struct osmo_dgram_rx *conn, int(*read_cb)(struct osmo_dgram_rx *conn))
Set the read() call-back of the datagram receiver.
Definition: datagram.c:336
osmo_stream_srv_link_set_port
void osmo_stream_srv_link_set_port(struct osmo_stream_srv_link *link, uint16_t port)
Set the local port number to which we bind.
Definition: stream.c:1066
osmux_xfrm_output_set_tx_cb
void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h, void(*tx_cb)(struct msgb *msg, void *data), void *data)
Set transmission callback to call when a generated RTP packet is to be transmitted.
Definition: osmux.c:882
osmo_stream_cli_get_ofd
struct osmo_fd * osmo_stream_cli_get_ofd(struct osmo_stream_cli *cli)
Get Osmocom File Descriptor of the stream client socket.
Definition: stream.c:676
osmo_dgram_rx_close
void osmo_dgram_rx_close(struct osmo_dgram_rx *conn)
Close the datagram receiver and unregister from select loop Does not destroy the datagram receiver,...
Definition: datagram.c:381
osmo_stream_cli_get_data
void * osmo_stream_cli_get_data(struct osmo_stream_cli *cli)
Get application private data of the stream client socket.
Definition: stream.c:655
osmo_stream_srv_set_flush_and_destroy
void osmo_stream_srv_set_flush_and_destroy(struct osmo_stream_srv *conn)
Prepare to send out all pending messages on the connection's Tx queue and then automatically destroy ...
Definition: stream.c:1390
osmo_stream_srv_get_ofd
struct osmo_fd * osmo_stream_srv_get_ofd(struct osmo_stream_srv *srv)
Get Osmocom File Descriptor of the stream server.
Definition: stream.c:1417
osmo_stream_srv_link_close
void osmo_stream_srv_link_close(struct osmo_stream_srv_link *link)
Close the stream server link and unregister from select loop Does not destroy the server link,...
Definition: stream.c:1246
osmo_dgram_set_read_cb
void osmo_dgram_set_read_cb(struct osmo_dgram *conn, int(*read_cb)(struct osmo_dgram *conn))
Set the read() call-back of the datagram receiver.
Definition: datagram.c:490
osmo_jibuf_enable_skew_compensation
void osmo_jibuf_enable_skew_compensation(struct osmo_jibuf *jb, bool enable)
Toggle use of skew detection and compensation mechanism.
Definition: jibuf.c:449
osmo_stream_srv_link_set_accept_cb
void osmo_stream_srv_link_set_accept_cb(struct osmo_stream_srv_link *link, int(*accept_cb)(struct osmo_stream_srv_link *link, int fd))
Set the accept() call-back of the stream server link.
Definition: stream.c:1175
osmo_dgram_set_local_addr
void osmo_dgram_set_local_addr(struct osmo_dgram *conn, const char *addr)
Set the local address to which we bind.
Definition: datagram.c:455
osmo_jibuf_alloc
struct osmo_jibuf * osmo_jibuf_alloc(void *talloc_ctx)
Allocate a new jitter buffer instance.
Definition: jibuf.c:298
osmo_dgram_send
void osmo_dgram_send(struct osmo_dgram *conn, struct msgb *msg)
Enqueue data to be sent via an Osmocom datagram transceiver.
Definition: datagram.c:544
osmo_ipa_unit
Definition: ipa_unit.c:27
osmo_stream_cli_set_port
void osmo_stream_cli_set_port(struct osmo_stream_cli *cli, uint16_t port)
Set the remote port number to which we connect.
Definition: stream.c:531
osmo_stream_srv_link_open
int osmo_stream_srv_link_open(struct osmo_stream_srv_link *link)
Open the stream server link. This actually initializes the underlying socket and binds it to the conf...
Definition: stream.c:1194
osmux_xfrm_output_flush
void osmux_xfrm_output_flush(struct osmux_out_handle *h)
Flush all scheduled RTP packets still pending to be transmitted.
Definition: osmux.c:322
osmo_stream_cli_reconnect
void osmo_stream_cli_reconnect(struct osmo_stream_cli *cli)
Re-connect an Osmocom Stream Client If re-connection is enabled for this client (which is the case un...
Definition: stream.c:277
osmo_dgram_rx_set_addr
void osmo_dgram_rx_set_addr(struct osmo_dgram_rx *conn, const char *addr)
Set the local address to which we bind.
Definition: datagram.c:316
osmo_dgram
Definition: datagram.c:394
osmux_input_state
Definition: osmux.c:394
sap_ctl_prim
Definition: prim.c:118
osmux_snprintf
int osmux_snprintf(char *buf, size_t size, struct msgb *msg)
Definition: osmux.c:1074
osmo_stream_cli_set_type
int osmo_stream_cli_set_type(struct osmo_stream_cli *cli, int type)
Set the socket type for the stream server link.
Definition: stream.c:599
osmo_stream_srv_link_set_type
int osmo_stream_srv_link_set_type(struct osmo_stream_srv_link *link, int type)
Set the socket type for the stream server link.
Definition: stream.c:1091
osmux_batch
Definition: osmux.c:338
jibuf.h
Osmocom Jitter Buffer helpers.
osmo_dgram_set_data
void osmo_dgram_set_data(struct osmo_dgram *conn, void *data)
Set application private data of the datagram transmitter.
Definition: datagram.c:499
ipa_head
Definition: ipa.h:10
osmo_stream_srv_link_get_data
void * osmo_stream_srv_link_get_data(struct osmo_stream_srv_link *link)
Get application private data of the stream server link.
Definition: stream.c:1139
osmo_stream_cli_create
struct osmo_stream_cli * osmo_stream_cli_create(void *ctx)
Create an Osmocom stream client.
Definition: stream.c:468
osmo_dgram_set_local_port
void osmo_dgram_set_local_port(struct osmo_dgram *conn, uint16_t port)
Set the local port to which we bind.
Definition: datagram.c:473
osmo_dgram_tx_set_local_addr
void osmo_dgram_tx_set_local_addr(struct osmo_dgram_tx *conn, const char *addr)
Set the local address from which we transmit.
Definition: datagram.c:171
osmo_stream_srv_send
void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg)
Enqueue data to be sent via an Osmocom stream server.
Definition: stream.c:1449
osmo_stream_srv_link_set_addrs
int osmo_stream_srv_link_set_addrs(struct osmo_stream_srv_link *link, const char **addr, size_t addrcnt)
Set the local address set to which we bind. Useful for protocols allowing bind on more than one addre...
Definition: stream.c:1043
amr_hdr
Definition: amr.h:45
osmo_prim_pkt_hdr
Definition: prim.c:40
osmo_stream_cli_get_sockname
char * osmo_stream_cli_get_sockname(const struct osmo_stream_cli *cli)
Get the stream client socket description.
Definition: stream.c:663
osmux_xfrm_output_sched
int osmux_xfrm_output_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh)
Generate RTP packets from osmux frame AMR payload set and schedule them for transmission at appropiat...
Definition: osmux.c:270
osmo_jibuf_empty
bool osmo_jibuf_empty(struct osmo_jibuf *jb)
Check whether the jitter buffer instance has packets queued or not.
Definition: jibuf.c:418
osmo_dgram_set_remote_port
void osmo_dgram_set_remote_port(struct osmo_dgram *conn, uint16_t port)
Set the remote port to which we transmit.
Definition: datagram.c:482
osmo_stream_srv_create
struct osmo_stream_srv * osmo_stream_srv_create(void *ctx, struct osmo_stream_srv_link *link, int fd, int(*cb)(struct osmo_stream_srv *conn), int(*closed_cb)(struct osmo_stream_srv *conn), void *data)
Create a Stream Server inside the specified link.
Definition: stream.c:1357
osmux_tx_handle
Definition: osmux.c:922
osmo_jibuf_enqueue
int osmo_jibuf_enqueue(struct osmo_jibuf *jb, struct msgb *msg)
Try to enqueue a packet into the jitter buffer.
Definition: jibuf.c:342
osmo_stream_cli_set_domain
int osmo_stream_cli_set_domain(struct osmo_stream_cli *cli, int domain)
Set the socket type for the stream server link.
Definition: stream.c:618
osmo_stream_cli_open
int osmo_stream_cli_open(struct osmo_stream_cli *cli)
Open connection of an Osmocom stream client By default the client will automatically reconnect after ...
Definition: stream.c:798
osmo_stream_srv_link_set_addr
void osmo_stream_srv_link_set_addr(struct osmo_stream_srv_link *link, const char *addr)
Set the local address to which we bind.
Definition: stream.c:1031
osmo_stream_cli_is_connected
bool osmo_stream_cli_is_connected(struct osmo_stream_cli *cli)
Check if Osmocom Stream Client is in connected state.
Definition: stream.c:296
osmo_rs232
Definition: rs232.c:42
osmo_jibuf_set_dequeue_cb
void osmo_jibuf_set_dequeue_cb(struct osmo_jibuf *jb, osmo_jibuf_dequeue_cb dequeue_cb, void *cb_data)
Set dequeue callback for the jitter buffer.
Definition: jibuf.c:460
osmo_dgram_tx_set_data
void osmo_dgram_tx_set_data(struct osmo_dgram_tx *conn, void *data)
Set application private data of the datagram transmitter.
Definition: datagram.c:191
osmo_stream_srv_link_set_nodelay
void osmo_stream_srv_link_set_nodelay(struct osmo_stream_srv_link *link, bool nodelay)
Set the NODELAY socket option to avoid Nagle-like behavior Setting this to nodelay=true will automati...
Definition: stream.c:1019
osmo_stream_cli_close
void osmo_stream_cli_close(struct osmo_stream_cli *cli)
Close an Osmocom Stream Client.
Definition: stream.c:305
osmo_prim_srv
Definition: prim.c:90
osmo_dgram_recv
int osmo_dgram_recv(struct osmo_dgram *conn, struct msgb *msg)
Receive data via Osmocom datagram transceiver.
Definition: datagram.c:553
osmo_dgram_get_data
void * osmo_dgram_get_data(struct osmo_dgram *conn)
Get application private data of the datagram transceiver.
Definition: datagram.c:507
osmo_stream_srv_destroy
void osmo_stream_srv_destroy(struct osmo_stream_srv *conn)
Destroy given Stream Server This function closes the Stream Server socket, unregisters from select lo...
Definition: stream.c:1436
osmux.h
osmo_stream_cli_open2
int osmo_stream_cli_open2(struct osmo_stream_cli *cli, int reconnect) OSMO_DEPRECATED("Use osmo_stream_cli_set_reconnect_timeout() or osmo_stream_cli_reconnect() instead")
DEPRECATED: use osmo_stream_cli_set_reconnect_timeout() or osmo_stream_cli_reconnect() instead!...
Definition: stream.c:726
osmo_stream_cli_set_local_addrs
int osmo_stream_cli_set_local_addrs(struct osmo_stream_cli *cli, const char **addr, size_t addrcnt)
Set the local address set to which we connect. Useful for protocols allowing bind to more than one ad...
Definition: stream.c:564
osmo_dgram_rx_set_port
void osmo_dgram_rx_set_port(struct osmo_dgram_rx *conn, uint16_t port)
Set the local port to which we bind.
Definition: datagram.c:326
baudrate2termbits
Definition: rs232.c:164
osmo_dgram_rx
Definition: datagram.c:248
osmo_stream_srv_link_set_proto
void osmo_stream_srv_link_set_proto(struct osmo_stream_srv_link *link, uint16_t proto)
Set the protocol for the stream server link.
Definition: stream.c:1078
osmo_dgram_close
void osmo_dgram_close(struct osmo_dgram *conn)
Close an Osmocom Datagram Transceiver.
Definition: datagram.c:535
osmo_stream_cli_set_nodelay
void osmo_stream_cli_set_nodelay(struct osmo_stream_cli *cli, bool nodelay)
Set the NODELAY socket option to avoid Nagle-like behavior Setting this to nodelay=true will automati...
Definition: stream.c:785
osmo_stream_cli_set_read_cb
void osmo_stream_cli_set_read_cb(struct osmo_stream_cli *cli, int(*read_cb)(struct osmo_stream_cli *cli))
Set the call-back function called to read from the stream client socket.
Definition: stream.c:704
osmo_dgram_tx
Definition: datagram.c:64
osmo_stream_cli_send
void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg)
Enqueue data to be sent via an Osmocom stream client.
Definition: stream.c:871
osmo_dgram_rx_create
struct osmo_dgram_rx * osmo_dgram_rx_create(void *ctx)
Create an Osmocom datagram receiver.
Definition: datagram.c:300
osmo_stream_srv_recv
int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg)
Receive data via Osmocom stream server.
Definition: stream.c:1515
osmux_circuit
Definition: osmux.c:348
osmo_stream_cli
Definition: stream.c:248
rtp_x_hdr
Definition: rtp.h:37
sap_ctl_hello_param
Definition: prim.c:113
osmo_jibuf_set_min_delay
void osmo_jibuf_set_min_delay(struct osmo_jibuf *jb, uint32_t min_delay)
Set minimum buffer size for the jitter buffer.
Definition: jibuf.c:427
osmo_stream_srv_link_destroy
void osmo_stream_srv_link_destroy(struct osmo_stream_srv_link *link)
Destroy the stream server link. Closes + Releases Memory.
Definition: stream.c:1184
osmo_stream_cli_set_local_port
void osmo_stream_cli_set_local_port(struct osmo_stream_cli *cli, uint16_t port)
Set the local port number for the socket (to be bound to)
Definition: stream.c:542
osmo_stream_srv_link_get_sockname
char * osmo_stream_srv_link_get_sockname(const struct osmo_stream_srv_link *link)
Get description of the stream server link e. g. 127.0.0.1:1234.
Definition: stream.c:1147
osmo_dgram_tx_send
void osmo_dgram_tx_send(struct osmo_dgram_tx *conn, struct msgb *msg)
Enqueue data to be sent via an Osmocom datagram transmitter.
Definition: datagram.c:235
osmo_dgram_create
struct osmo_dgram * osmo_dgram_create(void *ctx)
Create an Osmocom datagram transceiver (bidirectional)
Definition: datagram.c:419
osmo_prim_pkt_hdr::sap
uint32_t sap
Definition: prim.c:41
osmo_dgram_open
int osmo_dgram_open(struct osmo_dgram *conn)
Open the datagram transceiver. This actually initializes the underlying sockets and binds/connects th...
Definition: datagram.c:515
osmo_stream_cli_set_data
void osmo_stream_cli_set_data(struct osmo_stream_cli *cli, void *data)
Set application private data of the stream client socket.
Definition: stream.c:647
osmo_prim_pkt_hdr::primitive
uint16_t primitive
Definition: prim.c:42
osmo_stream_srv_link_get_ofd
struct osmo_fd * osmo_stream_srv_link_get_ofd(struct osmo_stream_srv_link *link)
Get Osmocom File Descriptor of the stream server link.
Definition: stream.c:1167
osmo_stream_srv_link_create
struct osmo_stream_srv_link * osmo_stream_srv_link_create(void *ctx)
Create an Osmocom Stream Server Link A Stream Server Link is the listen()+accept() "parent" to indivi...
Definition: stream.c:996
osmo_dgram_tx_open
int osmo_dgram_tx_open(struct osmo_dgram_tx *conn)
Open connection of an Osmocom datagram transmitter.
Definition: datagram.c:207
osmux_out_handle
Definition: osmux.h:76
osmo_stream_srv_get_master
struct osmo_stream_srv_link * osmo_stream_srv_get_master(struct osmo_stream_srv *conn)
Get the master (Link) from a Stream Server.
Definition: stream.c:1425
osmo_jibuf
A structure representing a single instance of a jitter buffer.
Definition: jibuf.h:20
osmux_hdr
Definition: osmux.h:32
osmo_dgram_tx_destroy
void osmo_dgram_tx_destroy(struct osmo_dgram_tx *conn)
Destroy a Osmocom datagram transmitter.
Definition: datagram.c:198
osmo_stream_cli_set_reconnect_timeout
void osmo_stream_cli_set_reconnect_timeout(struct osmo_stream_cli *cli, int timeout)
Set the reconnect time of the stream client socket.
Definition: stream.c:638
osmux_xfrm_input
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid)
Definition: osmux.c:804
osmo_stream_cli_set_addrs
int osmo_stream_cli_set_addrs(struct osmo_stream_cli *cli, const char **addr, size_t addrcnt)
Set the remote address set to which we connect. Useful for protocols allowing connecting to more than...
Definition: stream.c:507
osmo_stream_cli_set_local_addr
void osmo_stream_cli_set_local_addr(struct osmo_stream_cli *cli, const char *addr)
Set the local address for the socket (to be bound to)
Definition: stream.c:553
osmo_dgram_tx_create
struct osmo_dgram_tx * osmo_dgram_tx_create(void *ctx)
Create an Osmocom datagram transmitter.
Definition: datagram.c:130
osmo_stream_srv_set_data
void osmo_stream_srv_set_data(struct osmo_stream_srv *conn, void *data)
Set application private data of the stream server.
Definition: stream.c:1399
osmo_dgram_rx_open
int osmo_dgram_rx_open(struct osmo_dgram_rx *conn)
Open the datagram receiver. This actually initializes the underlying socket and binds it to the confi...
Definition: datagram.c:353
rtp_hdr
Definition: rtp.h:7
osmo_jibuf_set_max_delay
void osmo_jibuf_set_max_delay(struct osmo_jibuf *jb, uint32_t max_delay)
Set maximum buffer size for the jitter buffer.
Definition: jibuf.c:437
osmo_stream_cli_destroy
void osmo_stream_cli_destroy(struct osmo_stream_cli *cli)
Destroy a Osmocom stream client (includes close)
Definition: stream.c:712
osmo_stream_srv_link_set_domain
int osmo_stream_srv_link_set_domain(struct osmo_stream_srv_link *link, int domain)
Set the socket type for the stream server link.
Definition: stream.c:1110