Commit graph

12646 commits

Author SHA1 Message Date
Wim Taymans
8d0c7c6e67 impl-node: include config.h to define HAVE_MALLOC_TRIM
It was previously not used..
2024-07-30 18:01:10 +02:00
Wim Taymans
7392e4df1b impl-node: reset pending state when moving driving node
Commit d04a28daef moved the configuration
of the IO_Position after we removed the node from the old driver but
forgot to move the code that updates the pending_state.

See #4094
2024-07-30 18:01:08 +02:00
Wim Taymans
25fbcae1b3 loop: release queue lock before calling invoke function
We don't actually need to hold the lock while calling the invoke
function, we only need the lock to protect the list of queues.
2024-07-30 18:01:01 +02:00
Wim Taymans
0d7c20760e impl-port: improve IO_Buffers management on ports
Make sure we clear IO_Buffers on the port and mixer before we clear the
buffers or the format. The IO_Buffer is used to check if the port should
be processed or not and its update is synchronized with the data-thread.

Set IO_Buffers on the mixer and node only after we have configured the
buffers on the node.

See #4094
2024-07-30 09:46:59 +02:00
Wim Taymans
628f292fb8 audioconvert: set IO_Buffers only when buffers are negotiated
The IO_Buffers is used in the data thread to check if the port should be
scheduled or not. Make sure it is only set after we set buffers on the
port and cleared before the buffers are cleared.

Make sure we sync the port->io with the data thread.

See #4094
2024-07-30 09:46:52 +02:00
Vlad
ba17264bdb bluez5: Update default sync_factor
Due to the how the kernel part of BlueZ computes the extended
advertising interval for a Broadcast Source, a sync_factor smaller
than 2 will result in an invalid interval value (too small).
2024-07-29 10:29:25 +02:00
Wim Taymans
d0d7e87588 modules: fix doc
Fixes #4134
2024-07-29 10:28:36 +02:00
Wim Taymans
e56939ac0f impl-link: make async link when on e of the nodes is async
We simply cannot schedule async nodes properly if we don't have the
async link. This change was done to make sure that driver sources don't
end up with async buffers and cause a unneccesary 1 cycle delay in
async clients. But we can fix this in a better way, like this:

Increment the cycle counter after we copy the output port buffers. This
ensures the async clients immediately pick up the new buffers (or the
output buffers from the previous cycle).

Also remove some old compatibility code that is no longer useful.

Fixes #4138
See #4133
2024-07-29 10:28:22 +02:00
Wim Taymans
b3688b163d loop: signal when queue is full
When our queue is full, signal the wakeup event to make sure the thread
will wake up and try to clear the queue before we go to sleep.
2024-07-29 10:27:35 +02:00
Wim Taymans
77147c9cd7 module-rtp: fix ptime and target_buffer checks
target_buffer is in samples and ptime in msec so we can't really compare
them. Use psamples instead, which is ptime but then as samples.

See #4095
2024-07-29 10:27:02 +02:00
Wim Taymans
7758bb2bb7 jack: jack_get_time() returns microseconds
As found by David García Goñi

Fixes #4128
2024-07-29 10:26:24 +02:00
Wim Taymans
b86ac34deb jack: don't check timestamps in mixdown
jack_port_get_buffer() can be called with 0 frames, This is to restrict
the available space in the returned midi buffer after mixdown. While we
mixdown, we should not check timestamps so that all midi events are
added to the mixdown buffer.

Fixes qsynth.
2024-07-29 10:26:13 +02:00
Wim Taymans
ad9dc1ec81 modules: don't unload module on stream error
Unloading the module on stream errors is a bit too much because a
suspend can clear the stream error again (or the error might not be
fatal)

This can happen for example when negotiation fails on some stream ports
(wireplumber tries to link the midi ports to audio ports) and it's
better to not completely fail on that.

Fixes #4121
2024-07-18 14:27:54 +02:00
Wim Taymans
08d14b7d51 impl-node: always INACTIVATE when stopping
A remote node is prepared when the Start command sync reply has been
received.

If we however quickly switch from active to inactive, the
pending reply is cancelled but the remote node will have set the
FINISHED status and will be ready to be scheduled.

Make it so that we always set the INACTIVE status when the node is
canceled and unprepared, even if we didn't get the reply and the node
was not prepared.

Fixes #4122
2024-07-18 14:27:16 +02:00
Daniel Lundqvist
4902646e73 module-jack-tunnel: Properly propagate error from dlopen()
dlopen() does not set errno on failure, rather you're supposed to call
dlerror() to get the latest error. dlerror() return a string so
instead return -ENOENT from weakjack_load_by_path().

Depending on errno weakjack_load() could think it successfully loaded
the library, and later module-jack-tunnel would crash because it call
a NULL function pointer.
2024-07-18 14:27:01 +02:00
Frédéric Danis
b19c3501e7 bluez5: backend-native: Send error for not supported event only as AG
The HS/HF roles should not sent error messages, only commands.
2024-07-18 14:26:32 +02:00
Pauli Virtanen
9478414773 alsa-card-profiles: revert HDMI/AC3 profiles
They don't work on all HDMI output devices, and availability is
not detected so they're available also when they don't work.

Selecting the profiles on non-working devices results to

spa.alsa: plug:{SLAVE="a52:0,'hw:0,3'"}p: snd_pcm_start: Broken pipe

and noise output to speakers. Revert these profiles from stable branch
for now as the break things.

This reverts commit 916d2cdb28.
This reverts commit d6c17681da.
2024-07-14 12:01:31 +03:00
Wim Taymans
1ba71c1be2 node-driver: 5 seconds of freewheel timeout is enough
We retry to run the graph every 5 seconds in case it didn't complete. A
10 seconds timeout feels quite long.
2024-07-12 12:30:42 +02:00
Wim Taymans
5f934b2b95 node: add a clock XRUN_RECOVER flag
Make a new flag that is set when the process function is called because
of a recover from a graph xrun.

Use this flag in the freewheel driver to detect a recover and to avoid
scheduling a new timeout. We should schedule a new timeout only when the
process function was called after completion.

This fixes export in ardour some more when the initial driver timeout
didn't complete (when, for example, some nodes were still starting up).
2024-07-12 12:30:37 +02:00
Eli Schwartz
3e210e4cf2 meson: fix conflicting use of feature-based dependency lookups
When spa-plugins is enabled, the gio-2.0 global dependency is
overwritten.

When bluez support is enabled, OR when gsettings is enabled, the gio-2.0
dependency is then detected as found. This means that
pipewire-module-protocol-pulse can end up enabling gsettings support
even if it has been forcibly turned off.

Rename the meson variables to ensure they are looked up separately.
2024-07-12 10:28:29 +02:00
Wim Taymans
f9689df37d 1.2.1 2024-07-12 09:24:23 +02:00
Wim Taymans
d55f5ef608 module-raop: remove unused deprecated header 2024-07-12 08:58:43 +02:00
Wim Taymans
16f629d224 thread: make it possible to set a custom create function
Make a property to pass a custom function pointer to create threads
instead of pthread_create.

Use this in jack instead of bypassing the thread utils create function,
which gives the wrong thread rt priority with rtkit.

Fixes #4099
2024-07-12 08:58:32 +02:00
Wim Taymans
f357798715 v4l2: Improve format and control enumeration
Use dynamic pod builder so that we can also build complex formats.

Make sure we zero the format before we parse it or else we end up with
potentially uninitialized values.

When ENUM_FRAMESIZES or VIDIOC_ENUM_FRAMEINTERVALS return EINVAL for the
first index, make a dummy result and continue with that. This will
trigger an intersect withe filter so that we end up with something valid
instead of nothing.

Handle 0 framerates without crashing.

See #4063
2024-07-12 08:58:09 +02:00
Wim Taymans
1447b660b5 v4l2: use a dynamic pod builder to handle larger PropInfo
The labels from the vivid driver need more space so use a dynamic
builder to make sure we can handle them.

See #4063
2024-07-12 08:57:53 +02:00
Wim Taymans
beb485799d module-snapcast: don't hardcode the JSON message id
Use a counter to make it increment for each message.
2024-07-12 08:57:43 +02:00
Wim Taymans
6da99d7070 module-protocol-simple: use interface address as server address
Move the address:port parsing code to the net helper. Add a default
address option.

Pass the interface address to protocol-simple and use this as the
default address for listening.

This makes sure that when the user passes tcp:3400 that we don't end up
publishing 0.0.0.0:3400 but the actual address of the interface we are
listening on so that the snapcast discover can use this to notify the
snapcast server.

Fixes #4093
2024-07-12 08:57:27 +02:00
Pauli Virtanen
916d2cdb28 alsa-card-profiles: reduce priority of HDMI/AC3 profiles
These don't appear to work correctly on all hardware, even if ACP thinks
they are present, so reduce their priority
2024-07-12 08:57:06 +02:00
Pauli Virtanen
a5e4ef7d11 spa: alsa: recognize plug+a52 as a52 device strings
HDMI/AC3 profiles use plug+a52 for a52 output, and should be handled
like a52.
2024-07-12 08:56:51 +02:00
Pauli Virtanen
aa74a502d0 spa: utils: explicitly preserve errno in spa_cleanup handlers
The cleanup handlers like free(), close(), etc. aren't necessarily
guaranteed to preserve errno, so do it explicitly.

This allows for usage in functions that return NULL + errno to signal
errors.
2024-07-12 08:56:44 +02:00
Pauli Virtanen
e7e1d25a89 spa: alsa: fix multiple %f in node device strings of nodes
ACP allows multiple %f in device strings (cf pa_alsa_open_by_template),
but we replace only one of them when emitting the nodes. The a52
profiles in default.conf use multiple %f and probably don't work.

Fix to replace also multiple %f when emitting ACP device nodes.
2024-07-12 08:56:20 +02:00
Pauli Virtanen
b80d115140 conf: fix context.exec args parsing
The 'args' can be either JSON array, or a string.  If a string it should
not be parsed as JSON for a second time, but instead split at
whitespaces.
2024-07-12 08:56:01 +02:00
David Coles
51b3778f7c loop: fix update_timer handling of solo repeat argument
I believe the intent here is that if a `interval` is provided
but `value` is unset, then `value` should default to `period`
so the timer first fires after one `interval`.

Since `interval` is always a relative duration, `value` should
be interpreted as a relative duration, not an absolute one.
2024-07-12 08:54:23 +02:00
Robert Mader
8dfae10746 gst: src: Reset transform on stream stop
When a stream is stopped, chances are high that downstream elements
change or get reset, i.e. don't remember a previously send rotation
event. Thus reset the transform value in order to ensure we create a new
one on the next stream start.

In order to not regress the case when downstream *does* remember the
orientation and the buffer orientation changes from e.g.
`TRANSFORMATION_90` to `TRANSFORMATION_None` between stream
stop and restart, initialize the remembered transform to an invalid
value and ensure we always send a rotation event, even for
`TRANSFORMATION_None`.
2024-07-09 13:08:42 +02:00
Robert Mader
2fcb90f661 gst: stream: Destroy stream before clearing variable
`pw_stream_destroy()` chains up to `on_remove_buffer()` in
GstPipeWireSrc which again needs the stream to still be around to call
`pw_stream_queue_buffer()` on it. By using `g_clear_pointer()` it will
already have been cleared, causing crashes.

Revert to the behavior from before the commit mentioned below and add a
comment in order to avoid regressing in a future cleanup.

Fixes: 0c40c0147 (gst: factor out the stream management and some common variables in a new class)
2024-07-09 13:08:26 +02:00
Wim Taymans
d08df293a9 impl-node: set INACTIVE state on server
Don't wait for the client to set the INACTIVE state, do it on the
server. We already decremented the target required so we don't want to
schedule the node anymore.

Fixes some xruns when removing nodes in a stress test.
2024-07-03 18:04:01 +02:00
Wim Taymans
525360d70a impl-node: disable async for driver nodes
Make it so that a driver node can never be scheduled async. It could
possibly make sense when the driver node is not currently driving the
graph but when it drives the graph it always needs to be sync. This
also simplifies the target activation because we can simply check the
async state and ignore if the node is driving or not.

Also make sure that we never make an async link with a driver output port.
This does not make sense because the driver node will always be
triggered sync first and before the async node so we can simply make
a sync link.

This fixes the modified (only generate 1 buffer) video-src -> video-play
case where the buffer never arrives in video-play because of the
useless async link.

Fixes #4092
2024-07-03 14:49:49 +02:00
Wim Taymans
e6c0014f94 context: Fix node collect with groups and sync enabled
Keep track of the sync nodes we added to a driver and bring in the other
nodes from the same sync group, group or link groups. This makes it
possible to have disjoint sync groups each with their own driver.

Fixes export in ardour8

Fixes #4083
2024-07-01 16:09:03 +02:00
Wim Taymans
82b9fa118f module-raop: only set softVolume when valid 2024-07-01 11:27:17 +02:00
Wim Taymans
b8d07e40d6 impl-node: fix required state for async driver nodes
When the node activation.required was incremented because it was a
driver, only decrement it in that case, regardless of the current driver
state of the node.

This fixes the case of KODI where the required field gets out of sync
and things become unschedulable.

Fixes #4087
2024-07-01 10:58:12 +02:00
Wim Taymans
7b4c0dd5ec 1.2 2024-06-27 15:31:45 +02:00
Wim Taymans
1e5d9cc635 impl-node: increment async driver nodes required field
A driver can't be async, we always need to be able to trigger it
to start it so increment the required field.

Fixes an issue with asunc drivers such as the video-src example or gnome
screen sharing.
2024-06-27 13:22:52 +02:00
Barnabás Pőcze
7732d0e3e5 pipewire: module-raop-sink: use uint32_t for sample rate
32 bits are enough, and additionally this also fixes an incorrect
format string, which caused the default `audio.rate` to be
incorrectly set on some platforms, such as 32-bit arm ones.

Fixes #4080
2024-06-27 09:46:45 +02:00
Christian Glombek
4067b3a985 module-rtp/stream: Fix setting marker_on_first prop for RAOP 2024-06-27 06:04:56 +02:00
Christian Glombek
34ae5ce649 module-raop-sink: Fix setting sess.ts-direct prop 2024-06-27 05:44:50 +02:00
Arun Raghavan
3f35b80402 spa: aec: webrtc: Fix multichannel processing
Missed this parameter while porting to webrtc-audio-processing 1.0.
2024-06-25 15:34:30 -04:00
Barnabás Pőcze
7674b15fab pipewire-v4l2: move open*() flag check into function
This commit moves the check that determines whether the mode
argument of `open*()` exists into a separate function.

With that, the check is fixed because previously it failed to
account for the fact that `O_TMPFILE` is not a power of two.

Furthermore, add `assert()`s in the fortified variants that
ensure that no mode is required by the specified flags.
2024-06-25 19:10:13 +02:00
Wim Taymans
9d1d1fcbef impl-port: add port.group property
Can be used to group ports together. Mostly because they are all from
the same stream and split into multiple ports by audioconvert/adapter.

Also useful for the alsa sequence to group client ports together.

Also interesting when pw-filter would be able to handle streams in the
future to find out what ports belong to what streams.
2024-06-24 13:38:09 +02:00
Quentin
54c3fa06ed Update oc.po 2024-06-24 09:53:51 +00:00
Arun Raghavan
92c9b27c94 pw-cli: Dump object info on events
This prints changed state, props and params when run with -m and running
the `info` command. We try to print only things that have changed. It
would probably be good to make the props (and params) print a diff of
what's changed as well.
2024-06-21 16:08:24 -04:00