MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ process_default()

void MayaFlux::Vruta::TaskScheduler::process_default ( ProcessingToken  token,
uint64_t  processing_units 
)
private

Process tasks in a specific domain with default algorithm.

Parameters
tokenProcessing domain
processing_unitsNumber of units to process

Definition at line 254 of file Scheduler.cpp.

255{
256 auto clock_it = m_token_clocks.find(token);
257 if (clock_it == m_token_clocks.end()) {
258 return;
259 }
260
261 auto tasks = get_tasks_for_token(token);
262 if (tasks.empty()) {
263 auto& clock = *clock_it->second;
264 clock.tick(processing_units);
265 return;
266 }
267
268 auto& clock = *clock_it->second;
269
270 for (uint64_t i = 0; i < processing_units; i++) {
271 uint64_t current_context = clock.current_position();
272
273 for (auto& routine : tasks) {
274 if (routine && routine->is_active()) {
275 if (routine->requires_clock_sync()) {
276 if (current_context >= routine->next_execution()) {
277 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
278 }
279 } else {
280 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
281 }
282 }
283 }
284
285 clock.tick(1);
286 }
287}
static MayaFlux::Nodes::ProcessingToken token
Definition Timers.cpp:8
std::vector< std::shared_ptr< Routine > > get_tasks_for_token(ProcessingToken token) const
Get all tasks for a specific processing domain.
Definition Scheduler.cpp:90
std::unordered_map< ProcessingToken, std::unique_ptr< IClock > > m_token_clocks
Clock instances for each processing domain.
@ SAMPLE_BASED
Sample-accurate delay (audio domain)

References get_tasks_for_token(), m_token_clocks, MayaFlux::Vruta::SAMPLE_BASED, and token.

Referenced by process_token().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: