Bufferpool Library

Memory handling. More...

Data Structures

struct  bp_slot
 Network Playout Buffer Slots. More...
struct  poitem
 Network Playout Element. More...
struct  playout_buff_t
 Network Playout Buffer. More...
struct  buffer_pool_t
 Buffer Pool Management. More...

Defines

#define BP_SLOT_NUM   150
#define BP_SLOT_SIZE   2048
#define BP_SIZE   BP_SLOT_NUM*BP_SLOT_SIZE
#define BP_MAX_SIZE   BP_SLOT_NUM*50
#define PKT_DUPLICATED   1
#define PKT_MISORDERED   2

Typedefs

typedef struct playout_buff_t playout_buff
typedef struct buffer_pool_t buffer_pool

Functions

int poinit (playout_buff *, buffer_pool *)
 Inizializza il Buffer di Playout.
int poadd (playout_buff *, int, uint32_t)
 Inserisce un elemento nel Buffer di Playout.
int podel (playout_buff *, int)
 Rimuove un elemento dal Buffer di Playout.
int bpinit (buffer_pool *)
 Inizializza il Buffer Pool.
int bpkill (buffer_pool *)
 Funzione per la chiusura della libreria Bufferpool.
int bpget (buffer_pool *)
 Restituisce uno slot di memoria libero dal Buffer Pool.
int bpfree (buffer_pool *, int)
 Restituisce uno slot alla Free List.
int bprmv (buffer_pool *, playout_buff *, int)
 Rimuove uno slot dalla coda del Buffer di Plaout di Rete.
int bpenlarge (buffer_pool *bp)

Detailed Description

Memory handling.

bufferpool consists in functions to manipulate statically allocated fixed size slots of memory.

It also contains the high level functions to manage the playout buffer and the RTP packets queue.

This is used so that between receiving and decoding an RTP packet you can have just a single copy to memory.


Define Documentation

#define BP_SIZE   BP_SLOT_NUM*BP_SLOT_SIZE

Buffer Pool size

Definition at line 63 of file bufferpool.h.

#define BP_SLOT_NUM   150

The number of slots consisting the Playout Buffer.

Definition at line 55 of file bufferpool.h.

Referenced by bpinit(), and rtp_init().

#define BP_SLOT_SIZE   2048

Slot size. Derived from "Minimum Reassembly Buffer Size" IPv4: the maximal dimension of non fragmented packets

Definition at line 60 of file bufferpool.h.

Referenced by rtp_recv(), and socket_clear().


Function Documentation

int bpfree ( buffer_pool bp,
int  index 
)

Restituisce uno slot alla Free List.

Dopo aver rimosso un elemento dal Buffer di Playout, tramite la bpdel, inserisce in testa alla Free List l'indice dell'elemento liberato.

Parameters:
bp Il puntatore al Buffer Pool corrente.
index L'indice dello slot da liberare.
Returns:
0
See also:
podel

bufferpool.h

Definition at line 37 of file bpfree.c.

References buffer_pool_t::bufferpool, buffer_pool_t::fl_mutex, buffer_pool_t::flcount, buffer_pool_t::flhead, and buffer_pool_t::freelist.

Referenced by rtp_recv().

int bpget ( buffer_pool bp  ) 

Restituisce uno slot di memoria libero dal Buffer Pool.

Prende dalla testa della Free List l'indice di uno slot libero dal quale si puo' ricavare il puntatore all'area di memoria da utilizzare.

Parameters:
bp Il puntatore al Buffer Pool corrente.
Returns:
L'indice dello slot libero nel vettore del Buffer Pool.
See also:
bprmv

bufferpool.h

Definition at line 38 of file bpget.c.

References buffer_pool_t::cond_full, buffer_pool_t::fl_mutex, buffer_pool_t::flcount, buffer_pool_t::flhead, and buffer_pool_t::freelist.

Referenced by rtp_recv().

int bpinit ( buffer_pool bp  ) 

Inizializza il Buffer Pool.

Alloca la memoria per il Buffer di Playout e inizializza la Free List per la gestione interna della memoria. Inizializza la variabile di accesso in Mutua Esclusione alla Free List.

Parameters:
bp Il puntatore al Buffer Pool corrente.
Returns:
1 in caso di errore, 0 altrimenti.
See also:
bpkill

bufferpool.h

Definition at line 41 of file bpinit.c.

References BP_SLOT_NUM, buffer_pool_t::bufferpool, buffer_pool_t::cond_full, buffer_pool_t::fl_mutex, buffer_pool_t::flcount, buffer_pool_t::flhead, buffer_pool_t::freelist, and buffer_pool_t::size.

Referenced by rtp().

int bpkill ( buffer_pool bp  ) 

Funzione per la chiusura della libreria Bufferpool.

Libera la memoria precedentemente allocata per il Buffer Pool. Da questo momento in poi il Bufferpool non è più accessibile.

Parameters:
bp Il puntatore al Buffer Pool corrente.
Returns:
0
See also:
bpinit

bufferpool.h

Definition at line 36 of file bpkill.c.

References buffer_pool_t::bufferpool.

Referenced by rtp_clean().

int bprmv ( buffer_pool bp,
playout_buff po,
int  index 
)

Rimuove uno slot dalla coda del Buffer di Plaout di Rete.

Si occupa di chiamare la funzione podel per la cancellazione dell'elemento dalla coda di playout e la funzione bpfree per l'eliminazione dal vettore del Bufferpool.

Parameters:
bp puntatore al vettore del Buffer Pool corrente
po puntatore alla lista del Buffer di Playout.
index indice dell'elemento da rimuovere.
Returns:
0
See also:
podel

bpfree

bufferpool.h

Definition at line 39 of file bprmv.c.

References buffer_pool_t::bufferpool, buffer_pool_t::cond_full, buffer_pool_t::fl_mutex, buffer_pool_t::flcount, buffer_pool_t::flhead, buffer_pool_t::freelist, poitem::next, playout_buff_t::po_mutex, playout_buff_t::pobuff, playout_buff_t::pocount, playout_buff_t::pohead, playout_buff_t::potail, and poitem::prev.

Referenced by rtp_recv(), and rtp_rm_pkt().

int poadd ( playout_buff po,
int  index,
uint32_t  cycles 
)

Inserisce un elemento nel Buffer di Playout.

L'inserimento e' ordinato secondo il numero di sequenza del pacchetto RTP. Si tratta di un normale inserimento in una lista doppio linkata con i collegameti effettuati tramite gli indici del vettore.

Parameters:
po Il Buffer Pool corrente.
index L'indice dello slot allocato dalla poget.
cycles I cicli del campo SEQ dei pacchetti RTP.
Returns:
0
See also:
bpget

podel

bufferpool.h

Definition at line 41 of file poadd.c.

References playout_buff_t::bufferpool, playout_buff_t::cycles, poitem::next, playout_buff_t::po_mutex, playout_buff_t::pobuff, playout_buff_t::pocount, playout_buff_t::pohead, playout_buff_t::potail, and poitem::prev.

Referenced by rtp_recv().

int podel ( playout_buff po,
int  index 
)

Rimuove un elemento dal Buffer di Playout.

La funzione gestisce solo la rimozione dal vettore del Buffer di Playout, ma non si occupa di reinserire l'elemento liberato nella free list. Questa azione compete al Buffer Pool e non al Buffer di Playout, quindi dovrà essere effettuata tramite la funzione bpfree. La podel non sarà mai chiamata direttamente all'interno di NeMeSI, ma solo attraverso la bprmv.

Parameters:
po Il puntatore al Buffer di Playout corrente.
index L'indice dell'elemento da rimuovere.
Returns:
0
See also:
bpfree

bprmv

bufferpool.h

Definition at line 42 of file podel.c.

References poitem::next, playout_buff_t::po_mutex, playout_buff_t::pobuff, playout_buff_t::pocount, playout_buff_t::pohead, playout_buff_t::potail, and poitem::prev.

int poinit ( playout_buff po,
buffer_pool bp 
)

Inizializza il Buffer di Playout.

Parameters:
po Il puntatore al Buffer di Playout.
bp Il puntatore il Buffer Pool.
Returns:
0
See also:
poadd

podel

bufferpool.h

Definition at line 35 of file poinit.c.

References buffer_pool_t::bufferpool, playout_buff_t::bufferpool, playout_buff_t::cycles, playout_buff_t::po_mutex, playout_buff_t::pocount, playout_buff_t::pohead, and playout_buff_t::potail.

Referenced by rtp_ssrc_check().


Generated on Tue Feb 3 03:10:02 2009 for libnemesi by  doxygen 1.5.4