PipeWire 1.2.5
Loading...
Searching...
No Matches
spa_io_clock Struct Reference

Absolute time reporting. More...

#include <spa/node/io.h>

Data Fields

uint32_t flags
 Clock flags.
 
uint32_t id
 Unique clock id, set by host application.
 
uint64_t nsec
 Time in nanoseconds against monotonic clock (CLOCK_MONOTONIC).
 
struct spa_fraction rate
 Rate for position/duration/delay/xrun.
 
uint64_t position
 Current position, in samples @ rate.
 
uint64_t duration
 Duration of current cycle, in samples @ rate.
 
int64_t delay
 Delay between position and hardware, in samples @ rate.
 
double rate_diff
 Rate difference between clock and monotonic time, as a ratio of clock speeds.
 
uint64_t next_nsec
 Estimated next wakeup time in nanoseconds.
 
struct spa_fraction target_rate
 Target rate of next cycle.
 
uint64_t target_duration
 Target duration of next cycle.
 
uint32_t target_seq
 Seq counter.
 
uint32_t cycle
 incremented each time the graph is started
 
uint64_t xrun
 Estimated accumulated xrun duration.
 

Detailed Description

Absolute time reporting.

Nodes that can report clocking information will receive this io block. The application sets the id. This is usually set as part of the position information but can also be set separately.

The clock counts the elapsed time according to the clock provider since the provider was last started.

Driver nodes are supposed to update the contents of SPA_IO_Clock before signaling the start of a graph cycle. These updated clock values become visible to other nodes in SPA_IO_Position. Non-driver nodes do not need to update the contents of their SPA_IO_Clock.

The host generally gives each node a separate spa_io_clock in SPA_IO_Clock, so that updates made by the driver are not visible in the contents of SPA_IO_Clock of other nodes. Instead, SPA_IO_Position is used to look up the current graph time.

A node is a driver when spa_io_clock::id in SPA_IO_Clock and spa_io_position.clock.id in SPA_IO_Position are the same.

Field Documentation

◆ flags

uint32_t spa_io_clock::flags

Clock flags.

◆ id

uint32_t spa_io_clock::id

Unique clock id, set by host application.

Examples
midi-src.c.

◆ nsec

uint64_t spa_io_clock::nsec

Time in nanoseconds against monotonic clock (CLOCK_MONOTONIC).

This fields reflects a real time instant in the past. The value may have jitter.

◆ rate

struct spa_fraction spa_io_clock::rate

Rate for position/duration/delay/xrun.

Examples
midi-src.c.

◆ position

uint64_t spa_io_clock::position

Current position, in samples @ rate.

Examples
midi-src.c.

◆ duration

uint64_t spa_io_clock::duration

Duration of current cycle, in samples @ rate.

Examples
audio-dsp-filter.c, audio-dsp-src.c, and midi-src.c.

◆ delay

int64_t spa_io_clock::delay

Delay between position and hardware, in samples @ rate.

◆ rate_diff

double spa_io_clock::rate_diff

Rate difference between clock and monotonic time, as a ratio of clock speeds.

◆ next_nsec

uint64_t spa_io_clock::next_nsec

Estimated next wakeup time in nanoseconds.

This time is a logical start time of the next cycle, and is not necessarily in the future.

◆ target_rate

struct spa_fraction spa_io_clock::target_rate

Target rate of next cycle.

◆ target_duration

uint64_t spa_io_clock::target_duration

Target duration of next cycle.

◆ target_seq

uint32_t spa_io_clock::target_seq

Seq counter.

must be equal at start and end of read and lower bit must be 0

◆ cycle

uint32_t spa_io_clock::cycle

incremented each time the graph is started

◆ xrun

uint64_t spa_io_clock::xrun

Estimated accumulated xrun duration.


The documentation for this struct was generated from the following file: