12 #ifndef ROC_PIPELINE_PIPELINE_LOOP_H_
13 #define ROC_PIPELINE_PIPELINE_LOOP_H_
312 enum ProcState { ProcNotScheduled, ProcScheduled, ProcRunning };
314 bool process_subframes_and_tasks_simple_(
audio::Frame& frame);
315 bool process_subframes_and_tasks_precise_(
audio::Frame& frame);
317 bool schedule_and_maybe_process_task_(
PipelineTask& task);
318 bool maybe_process_tasks_();
320 void schedule_async_task_processing_();
321 void cancel_async_task_processing_();
328 bool start_subframe_task_processing_();
337 void report_stats_();
383 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.
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.
PipelineLoop(IPipelineTaskScheduler &scheduler, const PipelineLoopConfig &config, const audio::SampleSpec &sample_spec)
Initialization.
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.
const nanoseconds_t Millisecond
One millisecond represented in nanoseconds.
const nanoseconds_t Microsecond
One microsecond represented in nanoseconds.
int64_t nanoseconds_t
Nanoseconds.
uint32_t stream_timestamp_t
Packet stream timestamp.
Optionally constructed object.
Base class for pipeline tasks.
Pipeline loop task processing parameters.
core::nanoseconds_t task_processing_prohibited_interval
Time interval during which no task processing is allowed. This setting is used to prohibit task proce...
bool enable_precise_task_scheduling
Enable precise task scheduling mode (default). The other settings have effect only when this is set t...
core::nanoseconds_t min_frame_length_between_tasks
Minimum frame duration between processing tasks. In-frame task processing does not happen until at le...
core::nanoseconds_t max_frame_length_between_tasks
Maximum frame duration between processing tasks. If the frame is larger than this size,...
core::nanoseconds_t max_inframe_task_processing
Maximum task processing duration happening immediately after processing a frame. If this period expir...
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.
Various units used in packets.