12 #ifndef ROC_PIPELINE_PIPELINE_LOOP_H_
13 #define ROC_PIPELINE_PIPELINE_LOOP_H_
269 enum ProcState { ProcNotScheduled, ProcScheduled, ProcRunning };
271 bool process_subframes_and_tasks_simple_(
audio::Frame& frame);
272 bool process_subframes_and_tasks_precise_(
audio::Frame& frame);
274 bool schedule_and_maybe_process_task_(
PipelineTask& task);
275 bool maybe_process_tasks_();
277 void schedule_async_task_processing_();
278 void cancel_async_task_processing_();
281 bool process_next_subframe_(
audio::Frame& frame,
size_t* frame_pos);
283 bool start_subframe_task_processing_();
291 void report_stats_();
298 const size_t min_samples_between_tasks_;
299 const size_t max_samples_between_tasks_;
334 size_t samples_processed_;
337 bool enough_samples_to_process_tasks_;
Sample specification. Describes sample rate and channels.
Thread-safe lock-free node-based intrusive multi-producer single-consumer queue.
Base class for non-copyable objects.
Pipeline task completion handler.
Pipeline task scheduler interface. PipelineLoop uses this interface to schedule asynchronous work....
Base class for task-based pipelines.
virtual uint64_t tid_imp() const =0
Get current thread id.
size_t num_pending_frames() const
How much pending frames are there.
virtual core::nanoseconds_t timestamp_imp() const =0
Get current time.
void schedule(PipelineTask &task, IPipelineTaskCompleter &completer)
Enqueue a task for asynchronous execution.
virtual bool process_task_imp(PipelineTask &task)=0
Process task.
virtual bool process_subframe_imp(audio::Frame &frame)=0
Process subframe.
PipelineLoop(IPipelineTaskScheduler &scheduler, const TaskConfig &config, const audio::SampleSpec &sample_spec)
Initialization.
size_t num_pending_tasks() const
How much pending tasks are there.
void process_tasks()
Process some of the enqueued tasks, if any.
const Stats & get_stats_ref() const
Get task processing statistics. Returned object can't be accessed concurrently with other methods.
bool process_subframes_and_tasks(audio::Frame &frame)
Split frame and process subframes and some of the enqueued tasks.
bool schedule_and_wait(PipelineTask &task)
Enqueue a task for asynchronous execution and wait until it finishes.
Base class for pipeline tasks.
Pipeline task completion handler.
Pipeline task scheduler interface.
Multi-producer single-consumer queue.
int64_t nanoseconds_t
Nanoseconds.
Optionally constructed object.
Base class for pipeline tasks.
Task processing statistics.
uint64_t task_processed_in_frame
Number of tasks processed in process_frame_and_tasks().
uint64_t preemptions
Number of times when other method was preempted by process_frame_and_tasks().
uint64_t scheduler_cancellations
Number of time when cancel_task_processing() was called.
uint64_t task_processed_in_place
Number of tasks processed directly in schedule() or schedule_and_wait().
uint64_t scheduler_calls
Number of time when schedule_task_processing() was called.
uint64_t task_processed_total
Total number of tasks processed.
Task processing parameters.
Various units used in packets.