|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Video frame buffer manager. More...
#include <lib/video/video_frame.h>
Data Fields | |
Double Buffering | |
| video_frame_t * | front_buffer |
| Currently displayed frame (reader owns) | |
| video_frame_t * | back_buffer |
| Currently written frame (writer owns) | |
Synchronization | |
| atomic_bool | new_frame_available |
| Atomic flag: true when new frame available. | |
| mutex_t | swap_mutex |
| Brief mutex for pointer swap only. | |
Frame Allocation | |
| video_frame_t | frames [2] |
| Pre-allocated frame structures (reused forever) | |
Statistics | |
| atomic_ullong | total_frames_received |
| Total frames received (atomic counter) | |
| atomic_ullong | total_frames_dropped |
| Total frames dropped (atomic counter) | |
| atomic_ullong | last_frame_sequence |
| Last frame sequence number (atomic) | |
Quality Metrics | |
| atomic_uint | avg_decode_time_us |
| Average decode time in microseconds (atomic) | |
| atomic_uint | avg_render_time_us |
| Average render time in microseconds (atomic) | |
Client Info | |
| uint32_t | client_id |
| Client ID this buffer belongs to. | |
| bool | active |
| True if buffer is active (receiving frames) | |
Buffer Management | |
| size_t | allocated_buffer_size |
| Size of allocated data buffers (for cleanup) | |
Video frame buffer manager.
Implements double-buffered frame management with atomic pointer swaps for zero-copy frame transfer. Writer thread writes to back buffer while reader thread reads from front buffer. Atomic swap makes new frames available without blocking.
DOUBLE BUFFERING ARCHITECTURE:
SYNCHRONIZATION:
STATISTICS TRACKING:
Definition at line 176 of file video_frame.h.
| bool video_frame_buffer_t::active |
True if buffer is active (receiving frames)
Definition at line 216 of file video_frame.h.
Referenced by video_frame_begin_write(), video_frame_buffer_create(), video_frame_buffer_destroy(), video_frame_commit(), video_frame_get_latest(), and video_frame_get_stats().
| size_t video_frame_buffer_t::allocated_buffer_size |
Size of allocated data buffers (for cleanup)
Definition at line 222 of file video_frame.h.
Referenced by client_video_render_thread(), video_frame_buffer_create(), and video_frame_buffer_destroy().
| atomic_uint video_frame_buffer_t::avg_decode_time_us |
Average decode time in microseconds (atomic)
Definition at line 208 of file video_frame.h.
Referenced by video_frame_get_stats().
| atomic_uint video_frame_buffer_t::avg_render_time_us |
Average render time in microseconds (atomic)
Definition at line 209 of file video_frame.h.
Referenced by video_frame_get_stats().
| video_frame_t* video_frame_buffer_t::back_buffer |
Currently written frame (writer owns)
Definition at line 181 of file video_frame.h.
Referenced by video_frame_begin_write(), video_frame_buffer_create(), and video_frame_commit().
| uint32_t video_frame_buffer_t::client_id |
Client ID this buffer belongs to.
Definition at line 215 of file video_frame.h.
Referenced by video_frame_buffer_create(), and video_frame_commit().
| video_frame_t video_frame_buffer_t::frames[2] |
Pre-allocated frame structures (reused forever)
Definition at line 194 of file video_frame.h.
Referenced by video_frame_buffer_create(), and video_frame_buffer_destroy().
| video_frame_t* video_frame_buffer_t::front_buffer |
Currently displayed frame (reader owns)
Definition at line 180 of file video_frame.h.
Referenced by video_frame_buffer_create(), video_frame_commit(), and video_frame_get_latest().
| atomic_ullong video_frame_buffer_t::last_frame_sequence |
Last frame sequence number (atomic)
Definition at line 202 of file video_frame.h.
Referenced by video_frame_buffer_create().
| atomic_bool video_frame_buffer_t::new_frame_available |
Atomic flag: true when new frame available.
Definition at line 187 of file video_frame.h.
Referenced by video_frame_buffer_create(), video_frame_commit(), and video_frame_get_latest().
| mutex_t video_frame_buffer_t::swap_mutex |
Brief mutex for pointer swap only.
Definition at line 188 of file video_frame.h.
Referenced by video_frame_buffer_create(), and video_frame_buffer_destroy().
| atomic_ullong video_frame_buffer_t::total_frames_dropped |
Total frames dropped (atomic counter)
Definition at line 201 of file video_frame.h.
Referenced by video_frame_buffer_create(), video_frame_commit(), and video_frame_get_stats().
| atomic_ullong video_frame_buffer_t::total_frames_received |
Total frames received (atomic counter)
Definition at line 200 of file video_frame.h.
Referenced by video_frame_buffer_create(), video_frame_commit(), and video_frame_get_stats().