MayaFlux 1.0.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 484 of file Scheduler.cpp.

485{
486 auto clock_it = m_token_clocks.find(token);
487 if (clock_it == m_token_clocks.end()) {
488 return;
489 }
490
491 auto tasks = get_tasks_for_token(token);
492 if (tasks.empty()) {
493 auto& clock = *clock_it->second;
494 clock.tick(processing_units);
495 return;
496 }
497
498 auto& clock = *clock_it->second;
499
500 for (uint64_t i = 0; i < processing_units; i++) {
501 uint64_t current_context = clock.current_position();
502
503 for (auto& routine : tasks) {
504 if (routine && routine->is_active()) {
505 if (routine->requires_clock_sync()) {
506 if (current_context >= routine->next_execution()) {
507 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
508 }
509 } else {
510 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
511 }
512 }
513 }
514
515 clock.tick(1);
516 }
517}
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: