ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
ringbuffer.c File Reference

🎯 Lock-free circular buffer for audio streaming with atomic operations More...

Go to the source code of this file.

Macros

#define RINGBUFFER_CLIENT_ID_BUFFER_SIZE   64

Functions

ringbuffer_t * ringbuffer_create (size_t element_size, size_t capacity)
 Create a new ring buffer.
void ringbuffer_destroy (ringbuffer_t *rb)
 Destroy a ring buffer and free its memory.
bool ringbuffer_write (ringbuffer_t *rb, const void *data)
 Try to write an element to the ring buffer (non-blocking).
bool ringbuffer_read (ringbuffer_t *rb, void *data)
 Try to read an element from the ring buffer (non-blocking).
bool ringbuffer_peek (ringbuffer_t *rb, void *data)
 Peek at the next element without removing it.
size_t ringbuffer_size (const ringbuffer_t *rb)
 Get current number of elements in the buffer.
bool ringbuffer_is_empty (const ringbuffer_t *rb)
 Check if buffer is empty.
bool ringbuffer_is_full (const ringbuffer_t *rb)
 Check if buffer is full.
void ringbuffer_clear (ringbuffer_t *rb)
 Clear all elements from the buffer.
framebuffer_t * framebuffer_create (size_t capacity)
 Mutex-protected ring buffer used to exchange video frames.
framebuffer_t * framebuffer_create_multi (size_t capacity)
 Create a multi-source frame buffer for multi-user support.
void framebuffer_destroy (framebuffer_t *fb)
 Destroy a frame buffer.
bool framebuffer_write_frame (framebuffer_t *fb, const char *frame_data, size_t frame_size)
 Write a frame to the buffer.
bool framebuffer_read_frame (framebuffer_t *fb, frame_t *frame)
 Read a frame from the buffer.
void framebuffer_clear (framebuffer_t *fb)
 Clear all frames from the buffer, freeing their data.
bool framebuffer_write_multi_frame (framebuffer_t *fb, const char *frame_data, size_t frame_size, uint32_t source_client_id, uint32_t frame_sequence, uint32_t timestamp)
 Write a multi-source frame to the buffer (for multi-user support).
bool framebuffer_read_multi_frame (framebuffer_t *fb, multi_source_frame_t *frame)
 Read a multi-source frame from the buffer.
bool framebuffer_peek_latest_multi_frame (framebuffer_t *fb, multi_source_frame_t *frame)
 Peek at the latest multi-source frame without removing it.

Detailed Description

🎯 Lock-free circular buffer for audio streaming with atomic operations

Definition in file ringbuffer.c.

Macro Definition Documentation

◆ RINGBUFFER_CLIENT_ID_BUFFER_SIZE

#define RINGBUFFER_CLIENT_ID_BUFFER_SIZE   64

Definition at line 8 of file ringbuffer.c.

Referenced by framebuffer_write_multi_frame().