MayaFlux 0.3.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 252 of file Scheduler.cpp.

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