Skip to main content

ReleasePacer Class

Paces downstream releases of paired samples to a target frame rate. More...

Declaration

class simaai::neat::graph::strict_sync::ReleasePacer { ... }

Included Headers

#include <StrictSync.h>

Public Member Typedefs Index

usingOnSendResult = std::function< void(size_t, bool)>

Callback fired after each downstream send attempt; ok indicates success. More...

usingOnDrop = 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

boolenabled () const

True iff a positive target_fps was supplied (pacing active). More...

int64_tinterval_ms () const

Per-frame release interval in milliseconds. More...

size_tmax_queue () const

Per-stream maximum queue depth. More...

boolenqueue (size_t idx, simaai::neat::Sample &&sample)

Enqueue a paired sample for stream idx. Drops per max_queue policy on overflow. More...

voidstop ()

Stop the pacer; idempotent. More...

Statsstats (size_t idx) const

Snapshot of the per-stream stats. More...

Private Member Functions Index

voidworker_loop (size_t idx)

Private Member Attributes Index

std::vector< std::shared_ptr< simaai::neat::Run > >runs_
std::vector< std::unique_ptr< State > >states_
OnSendResulton_send_result_
OnDropon_drop_
int64_tinterval_ms_ = 0
size_tmax_queue_ = 0
std::atomic< bool >stopped_ {false}

Private Static Functions Index

static int64_tnow_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

PendingVideoStore

See Also

YoloTokenStore

Definition at line 156 of file StrictSync.h.

Public Member Typedefs

OnDrop

using simaai::neat::graph::strict_sync::ReleasePacer::OnDrop = std::function<void(size_t , int64_t )>

Callback fired when one or more samples are dropped due to overflow.

Definition at line 170 of file StrictSync.h.

170 using OnDrop = std::function<void(size_t /*stream_idx*/, int64_t /*dropped_count*/)>;

OnSendResult

using simaai::neat::graph::strict_sync::ReleasePacer::OnSendResult = std::function<void(size_t , bool )>

Callback fired after each downstream send attempt; ok indicates success.

Definition at line 168 of file StrictSync.h.

168 using OnSendResult = std::function<void(size_t /*stream_idx*/, bool /*ok*/)>;

Public Constructors

ReleasePacer()

simaai::neat::graph::strict_sync::ReleasePacer::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.

Definition at line 173 of file StrictSync.h.

Public Destructor

~ReleasePacer()

simaai::neat::graph::strict_sync::ReleasePacer::~ReleasePacer ()

Stops the pacer and joins worker threads.

Definition at line 176 of file StrictSync.h.

Public Member Functions

enabled()

bool simaai::neat::graph::strict_sync::ReleasePacer::enabled ()
inline

True iff a positive target_fps was supplied (pacing active).

Definition at line 179 of file StrictSync.h.

179 bool enabled() const {
180 return interval_ms_ > 0;
181 }

enqueue()

bool simaai::neat::graph::strict_sync::ReleasePacer::enqueue (size_t idx, simaai::neat::Sample && sample)

Enqueue a paired sample for stream idx. Drops per max_queue policy on overflow.

Definition at line 192 of file StrictSync.h.

interval_ms()

int64_t simaai::neat::graph::strict_sync::ReleasePacer::interval_ms ()
inline

Per-frame release interval in milliseconds.

Definition at line 183 of file StrictSync.h.

183 int64_t interval_ms() const {
184 return interval_ms_;
185 }

max_queue()

size_t simaai::neat::graph::strict_sync::ReleasePacer::max_queue ()
inline

Per-stream maximum queue depth.

Definition at line 187 of file StrictSync.h.

187 size_t max_queue() const {
188 return max_queue_;
189 }

stats()

Stats simaai::neat::graph::strict_sync::ReleasePacer::stats (size_t idx)

Snapshot of the per-stream stats.

Definition at line 196 of file StrictSync.h.

stop()

void simaai::neat::graph::strict_sync::ReleasePacer::stop ()

Stop the pacer; idempotent.

Definition at line 194 of file StrictSync.h.

Private Member Functions

worker_loop()

void simaai::neat::graph::strict_sync::ReleasePacer::worker_loop (size_t idx)

Definition at line 216 of file StrictSync.h.

Private Member Attributes

interval_ms_

int64_t simaai::neat::graph::strict_sync::ReleasePacer::interval_ms_ = 0

Definition at line 223 of file StrictSync.h.

223 int64_t interval_ms_ = 0;

max_queue_

size_t simaai::neat::graph::strict_sync::ReleasePacer::max_queue_ = 0

Definition at line 224 of file StrictSync.h.

224 size_t max_queue_ = 0;

on_drop_

OnDrop simaai::neat::graph::strict_sync::ReleasePacer::on_drop_

Definition at line 221 of file StrictSync.h.

221 OnDrop on_drop_;

on_send_result_

OnSendResult simaai::neat::graph::strict_sync::ReleasePacer::on_send_result_

Definition at line 220 of file StrictSync.h.

220 OnSendResult on_send_result_;

runs_

std::vector<std::shared_ptr<simaai::neat::Run> > simaai::neat::graph::strict_sync::ReleasePacer::runs_

Definition at line 218 of file StrictSync.h.

218 std::vector<std::shared_ptr<simaai::neat::Run>> runs_;

states_

std::vector<std::unique_ptr<State> > simaai::neat::graph::strict_sync::ReleasePacer::states_

Definition at line 219 of file StrictSync.h.

219 std::vector<std::unique_ptr<State>> states_;

stopped_

std::atomic<bool> simaai::neat::graph::strict_sync::ReleasePacer::stopped_ {false}

Definition at line 225 of file StrictSync.h.

225 std::atomic<bool> stopped_{false};

Private Static Functions

now_ms_i64()

int64_t simaai::neat::graph::strict_sync::ReleasePacer::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.