MayaFlux 0.2.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 256 of file Scheduler.cpp.

257{
258 auto clock_it = m_token_clocks.find(token);
259 if (clock_it == m_token_clocks.end()) {
260 return;
261 }
262
263 auto tasks = get_tasks_for_token(token);
264 if (tasks.empty()) {
265 auto& clock = *clock_it->second;
266 clock.tick(processing_units);
267 return;
268 }
269
270 auto& clock = *clock_it->second;
271
272 for (uint64_t i = 0; i < processing_units; i++) {
273 uint64_t current_context = clock.current_position();
274
275 for (auto& routine : tasks) {
276 if (routine && routine->is_active()) {
277 if (routine->requires_clock_sync()) {
278 if (current_context >= routine->next_execution()) {
279 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
280 }
281 } else {
282 routine->try_resume_with_context(current_context, DelayContext::SAMPLE_BASED);
283 }
284 }
285 }
286
287 clock.tick(1);
288 }
289}
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:92
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: