ReleasePacer Class
Paces downstream releases of paired samples to a target frame rate. More...
Declaration
Included Headers
Public Member Typedefs Index
| using | OnSendResult = std::function< void(size_t, bool)> |
|
Callback fired after each downstream send attempt; ok indicates success. More... | |
| using | OnDrop = std::function< void(size_t, int64_t)> |
|
Callback fired when one or more samples are dropped due to overflow. More... | |
Public Constructors Index
| ReleasePacer (const std::vector< std::shared_ptr< simaai::neat::Run > > &runs, int target_fps, size_t max_queue, OnSendResult on_send_result={}, OnDrop on_drop={}) | |
|
Construct the pacer over a vector of per-stream Runs with the target fps and queue cap. More... | |
Public Destructor Index
| ~ReleasePacer () | |
|
Stops the pacer and joins worker threads. More... | |
Public Member Functions Index
| bool | enabled () const |
|
True iff a positive target_fps was supplied (pacing active). More... | |
| int64_t | interval_ms () const |
|
Per-frame release interval in milliseconds. More... | |
| size_t | max_queue () const |
|
Per-stream maximum queue depth. More... | |
| bool | enqueue (size_t idx, simaai::neat::Sample &&sample) |
|
Enqueue a paired sample for stream idx. Drops per max_queue policy on overflow. More... | |
| void | stop () |
|
Stop the pacer; idempotent. More... | |
| Stats | stats (size_t idx) const |
|
Snapshot of the per-stream stats. More... | |
Private Member Functions Index
| void | worker_loop (size_t idx) |
Private Member Attributes Index
| std::vector< std::shared_ptr< simaai::neat::Run > > | runs_ |
| std::vector< std::unique_ptr< State > > | states_ |
| OnSendResult | on_send_result_ |
| OnDrop | on_drop_ |
| int64_t | interval_ms_ = 0 |
| size_t | max_queue_ = 0 |
| std::atomic< bool > | stopped_ {false} |
Private Static Functions Index
| static int64_t | now_ms_i64 () |
Description
Paces downstream releases of paired samples to a target frame rate.
Drains paired (frame + metadata) samples and forwards them to per-stream Run instances at a steady cadence derived from target_fps. Provides backpressure via a bounded queue and per-stream stats; optional callbacks fire on send completion and on drop events.
- See Also
- See Also
Definition at line 156 of file StrictSync.h.
Public Member Typedefs
OnDrop
|
Callback fired when one or more samples are dropped due to overflow.
Definition at line 170 of file StrictSync.h.
OnSendResult
|
Callback fired after each downstream send attempt; ok indicates success.
Definition at line 168 of file StrictSync.h.
Public Constructors
ReleasePacer()
|
Construct the pacer over a vector of per-stream Runs with the target fps and queue cap.
Definition at line 173 of file StrictSync.h.
Public Destructor
~ReleasePacer()
|
Stops the pacer and joins worker threads.
Definition at line 176 of file StrictSync.h.
Public Member Functions
enabled()
| inline |
True iff a positive target_fps was supplied (pacing active).
Definition at line 179 of file StrictSync.h.
enqueue()
|
Enqueue a paired sample for stream idx. Drops per max_queue policy on overflow.
Definition at line 192 of file StrictSync.h.
interval_ms()
| inline |
Per-frame release interval in milliseconds.
Definition at line 183 of file StrictSync.h.
max_queue()
| inline |
Per-stream maximum queue depth.
Definition at line 187 of file StrictSync.h.
stats()
|
Snapshot of the per-stream stats.
Definition at line 196 of file StrictSync.h.
stop()
|
Stop the pacer; idempotent.
Definition at line 194 of file StrictSync.h.
Private Member Functions
worker_loop()
|
Definition at line 216 of file StrictSync.h.
Private Member Attributes
interval_ms_
|
Definition at line 223 of file StrictSync.h.
max_queue_
|
Definition at line 224 of file StrictSync.h.
on_drop_
|
Definition at line 221 of file StrictSync.h.
on_send_result_
|
Definition at line 220 of file StrictSync.h.
runs_
|
Definition at line 218 of file StrictSync.h.
states_
|
Definition at line 219 of file StrictSync.h.
stopped_
|
Definition at line 225 of file StrictSync.h.
Private Static Functions
now_ms_i64()
| static |
Definition at line 215 of file StrictSync.h.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.