Commit graph

11411 commits

Author SHA1 Message Date
Wim Taymans
8680c74d1b check if malloc_trim() is available 2023-10-04 10:59:26 +02:00
Wim Taymans
7e2f6757fc impl-node: do malloc_trim() after destroying a node.
Fixes #1840
2023-10-04 10:36:17 +02:00
Wim Taymans
14114a7386 audioconvert: warn -> debug 2023-10-03 20:39:40 +02:00
Wim Taymans
48e11c6fe0 audioconvert: handle realloc errors
The original pointer is untouched when realloc fails and returns NULL so
make sure we free the previous values.
2023-10-03 20:38:11 +02:00
Wim Taymans
d8c73ebede module-raop-sink: don't let mute change the volume
Use both the volume and mute to decide what volume to send.

Don't let the mute state overwrite the volume. Also never mute the
stream.

Pressing mute and unmute restores the previous volume this way.
2023-10-03 12:59:17 +02:00
Christian Glombek
c5cc364794 module-raop-sink: Fix volume calculation
The volume interval that RAOP devices understand is [-30,0],
where -30.0 equals min vol, and 0.0 equals max. vol.

The local system volume is represented as a cubic (volumetric)
value in the [0,1] interval.

So cube root system volume value, scale by 30 and
translate -30 to map to target output range.

The special value -144 denotes volume mute. Send a corresponding RTSP
message when mute is not already toggled on.
2023-10-03 07:15:17 +02:00
Barnabás Pőcze
5d0e82be7e pulse-server: module-echo-cancel: set pulse.module.id
Set `pulse.module.id` on every node that libpipewire-module-echo-cancel
creates so that one can see in the output of `pactl list {sinks,sources}`
which nodes were created by a particular instance of module-echo-cancel.

Fixes #3541
2023-10-02 22:04:34 +02:00
Wim Taymans
15a283834f filter-chain: add nofail flags
Add nofail flags to some filter-chain examples to avoid aborting on
startup and leaving the system in a silent state.

Add some more comments to guide people to change the paths to the
filters and config files where needed.
2023-10-02 17:49:33 +02:00
Wim Taymans
eca4822311 filter-chain: add custom volume support
Add capture.volumes and playback.volumes to control the graph controls
that handle the capture and playback volume respectively.

See #3434
2023-10-02 17:02:33 +02:00
Wim Taymans
be1a60c5f9 pw-cat: add DFF file suppport 2023-10-02 16:51:37 +02:00
Wim Taymans
428f766d11 audioadapter: always pass Start when passthrough
When we are operating in passthrough, let the Start command pass through
to the follower in all cases. Only do the negotiate/buffers when not in
passthrough.

This fixes a case where the buffers are cleared on the alsa node and it
Pauses but then never resumes in a Start because the node is already
started. The real problem is probably somewhere else (in PipeWire) but
for now this will improve things in passthrough.
2023-10-02 15:41:56 +02:00
Wim Taymans
96c12c2988 alsa: do playback sync even when alsa is paused
We only start the ALSA pcm after we get our first buffer.

We still need to do the sync through (and get the number of prefilled
samples) to make sure we set our new timeout and don't keep on waking
up quickly while the graph fetches the first buffer.
2023-10-02 15:38:52 +02:00
Wim Taymans
e1b6a4237f context: use smallest fraction for largest rate
To find the largest rate, we need to select the smallest fraction.

This fixes the case where 44100Hz was selected when there are 2 nodes,
one suggesting 44.1Khz and another 48Khz. After this, 48KHz is
selected.
2023-10-02 10:58:39 +02:00
Pauli Virtanen
bfcbeccec2 bluez5: adapt to changes in BlueZ BAP API
BlueZ master branch now puts various QoS fields into a separate dict, in
properties and method input and return values.

Adjust our code to match that.
2023-09-30 18:13:30 +00:00
Barnabás Pőcze
2e9633b6f6 spa: debug: log: add missing includes
Include `spa/debug/{pod,format,mem,dict}.h` for the declarations
of `spa_debugc_{pod,format,mem,dict}()`.
2023-09-30 17:22:12 +02:00
Wim Taymans
ee6e7021f0 loop: rate limit xrun messages
When the reader thread locks up for some reason, avoid excessive
logs about the invoke queue being filled.

See #3532
2023-09-30 09:29:20 +02:00
Barnabás Pőcze
ceb4f43944 pipewire: rtsp-client: use flexible array member for outgoing message content
There is no need to have an extra pointer in the struct that is
set to right after the object at initialization and is never modified
because a flexible array member can be used instead.
This has advantages: `struct message` is now smaller, and there is
no extra load when accessing `struct message::data`.
2023-09-29 16:55:54 +00:00
Barnabás Pőcze
37b2633756 pulse-server: reorder initialization to make proper cleanup possible
Previously, in case of errors, the struct members were not disposed of
correctly, leading to memory leaks. Reordering the initialization slightly
makes it possible to call `impl_free()`.

See https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1840#note_2106874
2023-09-29 18:19:13 +02:00
Wim Taymans
bcc902a55e modules: fix compilation on clang 2023-09-28 11:42:56 +02:00
Wim Taymans
45c99cd487 impl-link: recalc graph after destroy prepared link
Get and use the prepared state of the link *before* unpreparing
the link as part of the destroy.
2023-09-28 11:22:46 +02:00
Wim Taymans
447ad35585 filter-chain: have separate control values per handle
When we duplicate the filter, also duplicate the control values instead
of reusing the same value for all copies. We then duplicate the value
ourselves when setting a control. This makes it possible to later use
this for volume control.
2023-09-27 16:18:58 +02:00
Wim Taymans
ee8cb6aa67 filter-chain: fix gain when mixing 1 source
The gain was not used when mixing just one source.
2023-09-27 16:10:56 +02:00
Wim Taymans
c4944dad17 audioconvert: silence some debug info 2023-09-27 11:44:31 +02:00
Christian Glombek
4823e573dc module-raop-sink: Send POST /feedback every 2 seconds 2023-09-26 19:11:08 +02:00
Christian Glombek
2ae850aa49 module-raop-sink: Use "PipeWire/$VERSION" as UserAgent 2023-09-26 19:11:08 +02:00
Christian Glombek
def6514872 module-raop-sink: Set DACP-ID header 2023-09-26 19:11:08 +02:00
Christian Glombek
de329f3a62 module-raop-sink: Uppercase Client-Instance header 2023-09-26 19:11:08 +02:00
Christian Glombek
c4a18d6c5c module-raop-sink: Add Apple-Challenge only if RSA encrypted
Only add Apple-Challenge header once on ANNOUNCE,
and only if RSA encrypted.
2023-09-26 19:11:08 +02:00
Christian Glombek
a8f5d20384 module-raop-sink: Rename a bunch of things 2023-09-26 19:11:08 +02:00
Wim Taymans
9726f53e60 conf: fix regex matching
Reset skip to 0 for each value or else we won't be able to match
2 values when using regex.

Fixes #3528
2023-09-26 11:56:26 +02:00
Wim Taymans
93d27cb26f conf: lower pulse client priority
So that jack and native pipewire clients get more priority. The pulse
clients are supposed to less critical desktop apps.
2023-09-26 09:30:12 +02:00
Wim Taymans
4be0c5f365 stream: add EARLY_PROCESS flag
This will call the process function as soon as a new buffer is dequeued.
This can be used to keep the buffer at a certain fill level instead of
the minimal fill level without the flag.

Fixes #3480
2023-09-25 10:00:07 +02:00
Christian Glombek
7f14e14ab7 module-raop-sink: Use rtp_header for RTP messages 2023-09-25 08:37:56 +02:00
Samuel Thibault
8b807ded35 Add GNU/Hurd support 2023-09-24 15:11:52 +00:00
Samuel Thibault
f9559d2e83 node-driver: Cope with missing CLOCK_BOOTTIME 2023-09-24 15:11:52 +00:00
Samuel Thibault
5aefb1f9f4 module-pipe-tunnel.c: Include <sys/uio.h> to get struct iovec 2023-09-24 15:11:52 +00:00
Samuel Thibault
c5ff3c8e3c utils.h: Include <errno.h> to get ENODATA 2023-09-24 15:11:52 +00:00
Pauli Virtanen
a9cc3f2813 bluez5: deprioritize audio-gateway if remote is HFP HF + A2DP sink
If remote supports both HFP HF and AG, both may get connected, which
occurs with Pipewire<->Pipewire connection.  In this case, Pipewire on
both sides may pick the audio-gateway profile.

To avoid both sides being audio-gateway, if remote is both A2DP sink and
HF, use lower priority for the audio-gateway profile.  Generally, BlueZ
won't connect both A2DP Source and Sink between same devices at the same
time, so we use that to determine which side should be the receiver.
2023-09-24 15:45:33 +03:00
Pauli Virtanen
5f7afe588c bluez5: backend-native: fix codec handling with simultaneous HF & AG
It may occur that we have RFCOMM connected as both HF and AG.  The codec
switching and support checks should in this case always use the remote
HF RFCOMM.

Fix by finding the RFCOMM with the correct profile, remote as HF.
2023-09-24 15:45:33 +03:00
Wim Taymans
099e2cf27a alsa: silence an error after resync 2023-09-22 11:23:51 +02:00
Wim Taymans
224f1f16f1 pulse-server: emit stream changed after Latency param change
Piggy back on the Latency param change to emit a stream changed event
because we now might have a link between the stream and a device.

We should really watch for new links and emit change events for the
streams that it links to.

Fixes #3522
2023-09-21 16:42:08 +02: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
Arun Raghavan
e2f343e844 audiomixer: Correctly initialise data_loop
This got missed when it was added in commit
69d431acd4. Causes a crash when linking
passthrough ports.
2023-09-20 21:46:24 -04:00
Wim Taymans
cc0eb1ba0d context: handle force quantum like force_rate
Make sure we don't end looping when doing a reconfigure by using the
same logic as the force rate.
2023-09-20 16:58:12 +02:00
Wim Taymans
9bfe24d62f context: also reconfigure when quantum was forced
This makes the clock.force-quantum setting and node.force-quantum
suspend all drivers and resume them in the new quantum.

This is essential in order to change the quantum on an IRQ based
driver because it will otherwise refuse to change the graph quantum.
2023-09-20 15:46:41 +02:00
Wim Taymans
03840a2a9a alsa: fix recover logic
We can't call spa_alsa functions from the data thread. Iterate ourselves
over the linked devices that we all need to recover as a group.
2023-09-20 15:38:41 +02:00
Wim Taymans
a56ed47c5e alsa: set the driver rate in the clock io
Rename some variables to make it clear that we are dealing with the rate
and duration of the driver.
Set the driver rate in the clock instead of the target_rate, which we
might have rejected.
2023-09-20 11:32:34 +02:00
Wim Taymans
20db9e2d70 alsa: link driver and follower
When we are using the same clock (!matching) try to link the two PCM
devices together. This starts and stops the devices at the same time and
gives better latency.
2023-09-19 13:04:43 +02:00
Wim Taymans
4568d90565 jack: sync after setting metadata
Do a do_sync after setting the metadata to ensure the messages are
flushed to the server and processed. Fixes an issue where jack_property
would exit before the messages are flushed and so nothing happens.
2023-09-19 12:44:59 +02:00
Wim Taymans
ee1bb2362d alsa: sync followers from the driver
Keep track or the follower state and do the sync from the driver
wakeup.

This improves sync between devices because the sync no longer
depends on when the node was woken up in the graph and scheduled. We
would have been able to handle this difference by using the htimestamp
but that doesn't seen to work reliably on some hardware.

This is also essential for the interrupt based scheduling.
2023-09-18 14:53:15 +02:00