Commit graph

28 commits

Author SHA1 Message Date
Wim Taymans
2c5cdb57e5 Revert "node-driver: ensure position doesn't jump"
This reverts commit 8249fa3cbf.

See #3544
2023-10-05 15:22:30 +02:00
Samuel Thibault
f9559d2e83 node-driver: Cope with missing CLOCK_BOOTTIME 2023-09-24 15:11:52 +00:00
Wim Taymans
8249fa3cbf node-driver: ensure position doesn't jump
Make sure that the position only advances in the running state.

When we are not following a clock we can simply increment the position
with the duration every time we run.

If we are following a clock. Take the elapsed time of the clock into
account when aligning to the position.

Fixes #3189
2023-09-21 09:52:53 +02:00
Jonas Holmberg
00ca590ff6 node-driver, null-audio-sink: Fix EAGAIN check
spa_system_timerfd_read() returns -EAGAIN.
2023-09-04 13:24:30 +02:00
Dmitry Sharshakov
f257c3407d node-driver: allow specifying both PHC and ID 2023-06-20 06:51:30 +00:00
Wim Taymans
78b8e1af57 node-driver: fix position calculation
Set the driver node position based on the current time when we
start and keep incrementing it with the previous duration.
2023-03-24 17:34:14 +01:00
Wim Taymans
5ea3c10dca support: sync timers with data loop
Start and stop the timers in the data_loop. Otherwise we might be trying
to stop a timer while the data loop is starting it and we end up with
"ready non-active node" messages.
2023-03-24 17:24:56 +01:00
Wim Taymans
7b6680ba57 plugins: simplify target_ handling
Drivers should only read the target_ values in the timeout, update the
timeout with the new duration and then update the position.

For the position we simply need to add the previous duration to the
position and then set the new duration + rate.

Otherwise, everything else should read the duration/rate and not use
the target_ values.
2023-03-24 11:36:15 +01:00
Wim Taymans
6e8625cf96 node: update the duration/rate from the target
Before scheduling the graph from the driver, update the duration and
rate with the new targets.
2023-03-23 18:39:27 +01:00
Gleb Popov
a83d3b0249 Fix node-driver.c build on FreeBSD. 2023-03-15 16:53:41 +00:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
206df03c27 support: Handle supported clocks with timerfd
We don't need to follow a clock when it is one of the supported clocks
for timerfd.
2023-02-01 16:19:14 +01:00
Wim Taymans
e3b358ac8b support: add support for other clocks
Add support for using other clocks.
clock.id can be used to set one of the system clocks.
clock.device can be used to open a clock device such as a PTP clock
device.
Use a dll to track the progress of non-monotonic clocks.
2023-02-01 15:54:54 +01:00
Wim Taymans
f44d55f6c2 handle read from timerfd correctly
When reading the timerfd gives an error, we should return right away
because the timeout did not happen.

If we change the timerfd timeout before reading it, we can get -EAGAIN.
Don't log an error in that case but wait for the new timeout.
2022-12-09 17:30:31 +01:00
Barnabás Pőcze
60b9d9081b spa: only remove embedded source from data loop from within the loop
Use `spa_loop_invoke()` to invoke a callback on the data loop
to remove an embedded `spa_source` from the data loop.

Embedded `spa_source` objects cannot be safely removed
while the loop is polling without risking potential
use-after-frees.
2022-03-06 18:40:43 +00:00
Wim Taymans
53352c0c81 support: add property to configure clock name
Add a clock.name property on the driver node. By default this is
clock.system.monotonic for the monotonic system clock.
2021-12-10 11:22:23 +01:00
Wim Taymans
f1f5cbc0a6 support: return completion from process
HAVE_DATA|NEED_DATA signals that the graph can continue processing.
OK means that the node will continue asynchronously later. This
is needed to make the dummy driver work as a follower.
2021-09-23 16:36:32 +02:00
Wim Taymans
35194d6de0 node-driver: remove timers when not a driver 2021-07-01 12:28:18 +02:00
George Kiagiadakis
5aa9c95390 node-driver: make the timerfd non-blocking
Relates to #1377
2021-07-01 11:52:28 +03:00
Wim Taymans
46ef88e520 spa: save the old change_mask and restore when emitting full
When we add a new listener to an object, it will emit the full state
of the object. For this it temporarily sets the change_mask to all
changes. Restore the previous state after this or else we might not
emit the right change_mask for the next listener.

Consider the case where one there are two listeners on an object.
The object emits a change and the first listener wants to enumerate the
changed params. For this is adds a new listener and then triggers the
enumeration. If we set the change_mask to 0 after adding the listener,
the second listener would get a 0 change_mask and fail to update
its state.
2021-05-27 15:21:44 +02:00
Peter Hutterer
cdfd50e166 spa: add spa_atob() to convert a string to a boolean
This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
2021-05-18 22:18:56 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Wim Taymans
a80ec36ad5 node-driver: run as fast as possible in freewheel mode 2021-05-07 11:50:55 +02:00
Wim Taymans
888612dc0f conf: add freewheel driver
Add freewheel driver and enable freewheel mode on it.
2021-05-07 09:03:34 +02:00
Wim Taymans
5c41131d6d node-driver: support node.freewheel property
To activate freewheeling when initializing
2021-05-07 09:03:34 +02:00
Wim Taymans
6eaf8d6921 spa: remove property, we don't implement a getter 2020-10-28 10:51:08 +01:00
Wim Taymans
1b7d052098 support: remove useless assignment 2020-10-16 13:11:27 +02:00
Wim Taymans
2220d5b9b6 support: add dummy driver
Add a dummy driver node with high priority. All nodes not linked
to a device node will be linked to this when they require a driver.
2020-04-27 20:21:31 +02:00