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

◆ process_token()

void MayaFlux::Vruta::TaskScheduler::process_token ( ProcessingToken  token,
uint64_t  processing_units = 1 
)

Process all tasks for a specific processing domain.

Parameters
tokenProcessing domain to advance
processing_unitsNumber of units to process (samples/frames/etc.)

Advances the appropriate clock and processes all tasks that are ready to execute in the specified domain. This is the main entry point for backend-specific processing loops.

Definition at line 217 of file Scheduler.cpp.

218{
220
221 auto processor_it = m_token_processors.find(token);
222 if (processor_it != m_token_processors.end()) {
223 auto tasks = get_tasks_for_token(token);
224 processor_it->second(tasks, processing_units);
225 } else {
226 process_default(token, processing_units);
227 }
228
231 } else if (token == ProcessingToken::FRAME_ACCURATE) {
233 }
234
235 static uint64_t cleanup_counter = 0;
236 if (++cleanup_counter % (static_cast<uint64_t>(m_cleanup_threshold * 2)) == 0) {
238 }
239}
void cleanup_completed_tasks()
Clean up completed tasks in a domain.
uint32_t m_cleanup_threshold
Threshold for task cleanup.
std::vector< std::shared_ptr< Routine > > get_tasks_for_token(ProcessingToken token) const
Get all tasks for a specific processing domain.
std::unordered_map< ProcessingToken, token_processing_func_t > m_token_processors
Custom processors for specific domains.
void drain_pending_tasks()
Drain pending task operations (additions/removals) before processing.
void pump_cross(DelayContext context, ProcessingToken clock_token, uint64_t processing_units)
Pump the MULTI_RATE list from one clock's context.
void process_default(ProcessingToken token, uint64_t processing_units)
Process tasks in a specific domain with default algorithm.
@ FRAME_ACCURATE
Coroutine is frame-accurate.
@ SAMPLE_ACCURATE
Coroutine is sample-accurate.
@ FRAME_BASED
Frame-rate delay (Graphics domain)
@ SAMPLE_BASED
Sample-accurate delay (audio domain)

References cleanup_completed_tasks(), drain_pending_tasks(), MayaFlux::Vruta::FRAME_ACCURATE, MayaFlux::Vruta::FRAME_BASED, get_tasks_for_token(), m_cleanup_threshold, m_token_processors, process_default(), pump_cross(), MayaFlux::Vruta::SAMPLE_ACCURATE, and MayaFlux::Vruta::SAMPLE_BASED.

Referenced by process_all_tokens().

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