This is the chunk buffer of the peer. More...
Go to the source code of this file.
Typedefs | |
typedef struct chunk_buffer | ChunkBuffer |
Functions | |
struct chunk_buffer * | cb_init (const char *config) |
int | cb_add_chunk (struct chunk_buffer *cb, const struct chunk *c) |
struct chunk * | cb_get_chunks (const struct chunk_buffer *cb, int *n) |
int | cb_clear (struct chunk_buffer *cb) |
void | cb_destroy (struct chunk_buffer *cb) |
struct chunk * | cb_get_chunk (const struct chunk_buffer *cb, int id) |
This is the chunk buffer of the peer.
The chunks buffer is responsible for storing the chunks received by a peer. Each chunk is stored until the chunk buffer decides to discard it (for example, when some kind of playout delay is expired), then it is removed from the buffer. The buffer makes its chunks available to the output module and to the scheduler, in form of an ordered list (chunks are ordered by timestamp). Since every chunk has a timestamp and a sequence number (the chunk ID), the chunk buffer's clients (scheduler and output module) can easily check if there are gaps in the list.
typedef struct chunk_buffer ChunkBuffer |
Structure describing a chunk buffer. This is an opaque type.
int cb_add_chunk | ( | struct chunk_buffer * | cb, | |
const struct chunk * | c | |||
) |
Add a chunk to a buffer.
Insert a chunk in the given buffer. One or more chunks can be removed from the buffer (if necessary, and according to the internal logic of the chunk buffer) to create space for the new one.
cb | a pointer to the chunk buffer | |
c | a pointer to the descriptor of the chunk to be inserted in the buffer |
int cb_clear | ( | struct chunk_buffer * | cb | ) |
Clear a chunk buffer
Remove all the chunks from the specified chunk buffer.
cb | a pointer to the chunk buffer |
void cb_destroy | ( | struct chunk_buffer * | cb | ) |
Destroy a chunk buffer
Remove all the chunks from the specified chunk buffer, and free all the memory dynamically allocated to it.
cb | a pointer to the chunk buffer |
struct chunk* cb_get_chunk | ( | const struct chunk_buffer * | cb, | |
int | id | |||
) | [read] |
Get a specific chunk from a buffer
Provide one single chunk from the specified chunkbuffer, with the requested identifier.
cb | a pointer to the chunk buffer | |
id | the identifier of the chunk to be returned |
struct chunk* cb_get_chunks | ( | const struct chunk_buffer * | cb, | |
int * | n | |||
) | [read] |
Get the chunks from a buffer.
Provide an (ordered) list of the chunks which are currently stored in the specified chunk buffer. Such list is stored in a C arrary (so, after calling chunks_array = cb_get_chunks(cb), chunks_array[i] contains the i^th chunk).
cb | a pointer to the chunks buffer | |
n | a pointer to an integer variable where number of chunks will be stored |
struct chunk_buffer* cb_init | ( | const char * | config | ) | [read] |
Allocate a chunk buffer.
Allocate and initialise a chunk buffer structure, and return a pointer to it.
config | a text string containing some configuration parameters for the buffer, such as the playout delay and maybe some additional parameters (estimated size of the buffer, etc...) |