MayaFlux 0.4.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 386 of file Scheduler.cpp.

387{
388 auto clock_it = m_token_clocks.find(token);
389 if (clock_it == m_token_clocks.end()) {
390 return;
391 }
392
393 auto tasks = get_tasks_for_token(token);
394 if (tasks.empty()) {
395 auto& clock = *clock_it->second;
396 clock.tick(processing_units);
397 return;
398 }
399
400 auto& clock = *clock_it->second;
401
402 for (uint64_t i = 0; i < processing_units; i++) {
403 uint64_t current_context = clock.current_position();
404
405 for (auto& routine : tasks) {
406 if (routine && routine->is_active()) {
407 if (routine->requires_clock_sync()) {
408 if (current_context >= routine->next_execution()) {
409 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
410 }
411 } else {
412 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
413 }
414 }
415 }
416
417 clock.tick(1);
418 }
419}
std::unordered_map< ProcessingToken, std::shared_ptr< IClock > > m_token_clocks
Clock instances for each processing domain.
std::vector< std::shared_ptr< Routine > > get_tasks_for_token(ProcessingToken token) const
Get all tasks for a specific processing domain.
@ SAMPLE_BASED
Sample-accurate delay (audio domain)

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

Referenced by process_token().

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