Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
StreamBroadcaster Class Reference

Classes

struct  SendStats
 How long frame sends block the httpd task (every /stream send runs on it, and so does /commands). More...
 

Public Member Functions

bool start (httpd_handle_t server, FrameStore &store)
 Register the /stream WebSocket endpoint and start the stream task (core 1, priority 4).
 
void stop ()
 Stop the stream task and release all resources. Call BEFORE httpd_stop. Safe to call repeatedly.
 
uint32_t frames_sent () const
 
SendStats take_send_stats ()
 The send counters; resets max_us. For the stats line (one reader).
 
size_t viewer_count () const
 Connected /stream viewers (0 to frames::kMaxViewers).
 

Static Public Member Functions

static void on_session_closed (httpd_handle_t server, int sockfd)
 httpd close_fn: forget the viewer and close the socket (required when close_fn is set).
 

Static Public Attributes

static constexpr uint32_t kSlowSendUs = 200000
 200 ms: a visible hitch at 16 fps
 

Member Function Documentation

◆ viewer_count()

size_t StreamBroadcaster::viewer_count ( ) const

Connected /stream viewers (0 to frames::kMaxViewers).

Safe from any task, including the httpd task (the /commands reply): it takes the broadcaster mutex, which every holder keeps for a few microseconds only and never while calling back into this method, so the caller cannot deadlock and waits at most that long (the FreeRTOS mutex has priority inheritance). Returns 0 before start() and once stop() has returned. Like the httpd callbacks it must not run concurrently with stop() (which frees the mutex); stop() has no caller today, and httpd must be stopped first.


The documentation for this class was generated from the following files: