Commit graph

7972 commits

Author SHA1 Message Date
Barnabás Pőcze
b04b52ecf8 spa: alsa: do not look up the card again when releasing
Currently, `release_card()` uses `find_card()` to find the card
by the index stored in the state object. However, `find_card()`
increments the reference count of the object, therefore
`release_card()` will drop the reference that it has just
created by calling `find_card()` and not the "calling scope's"
reference. This prevents the card objects from being
freed when the SPA handle is cleared.

Fix it by having `release_card()` take a pointer to the card
and not its index.
2021-12-20 19:50:57 +01:00
Barnabás Pőcze
ee0963b68e spa: alsa: change index type
The `card` structure uses `uint32_t` for its index member,
on the other hand, the `state` structure uses `int`. No code
depends on it being `int`, therefore change it to `uint32_t`
for consistency.
2021-12-20 19:50:57 +01:00
Wim Taymans
3c66d46007 pulse-server: recalculate tlength on quantum change
Always reevaluate the tlength or total buffered samples when the
quantum changes, even for the first sample because it is possible that
we completely miscalculated the length when we started, like when the
quantum is force high and the requested latency is low.

Also only increase the calculated tlength, for smaller sizes we don't
need to do anything, we can keep the latency as is it.

See #1930
2021-12-20 17:33:55 +01:00
Wim Taymans
512a52d9c6 pulse-server: fix the number of enum values
Set the right number of enum values or else we might crash.

Fixes #1928
2021-12-20 09:13:37 +01:00
Wim Taymans
d2f676f9a6 pulser-server: push data instead of silence
When we are draining or underrunning, read whatever we have in the
ringbuffer instead of silence. This places the last samples before
the drain into the sink, padded with 0.

Fixes #1549
2021-12-18 12:32:44 +01:00
Wim Taymans
b223261240 pulse-server: flush after we push the last buffer 2021-12-18 12:32:20 +01:00
Wim Taymans
abbb034fa4 Revert "impl-core: require WX flags to destroy an object"
This reverts commit c14e89a578.

This makes it impossible for flatpak apps to remove links. Maybe:

- Flatpaks apps are not allowed to make lingering links
- Flatpak apps can only delete their own links.
- Some flatpaks apps needs to be tagged as manager in order to created
  lingering links and destroy any link.

Fixes #1920
2021-12-18 08:44:17 +01:00
Wim Taymans
f8cdc05720 alsa: allow multi-rate by default
We don't enable multiple rates by default and kernel 5.16 will fix
most issues so allow multiple rates per card.

See #1916
2021-12-18 08:33:34 +01:00
Wim Taymans
b476d6b503 alsa: add api.alsa.period-num param
To configure the amount of periods. By default we use as many as
possible but it is now possible to force a value.

See #1473
2021-12-17 16:09:52 +01:00
Wim Taymans
8630b8846c alsa: use position duration as period size
Use half of the configured quantum as the period size in batch mode.
This gives lower latency for USB devices depending on the quantum.
2021-12-17 16:08:08 +01:00
Jonas Holmberg
15ce86aff1 module-protocol-native: Fix errno check
handle_connection_error() takes errno as argument so check for positive
error codes.
2021-12-16 17:21:24 +01:00
Wim Taymans
c8fc79bad2 Revert "pulse-server: only try to increase the tlength"
This reverts commit 7f0255f4ce.

Doesn't work with small quant for some reason.
2021-12-16 17:10:38 +01:00
Wim Taymans
7f0255f4ce pulse-server: only try to increase the tlength
PulseAudio only tries to increase tlength, never decrease so let's
do the same.
2021-12-16 17:08:23 +01:00
Wim Taymans
68cd9ac738 alsa: only use graph rate when nothing else is fixed
Only fall back to suggest the graph rate when we don't have a forced
rate or the card was not already in a format.

See #1892
2021-12-16 15:32:36 +01:00
Wim Taymans
7ef2b27376 acp: sync with pulseaudio
Include the alsa-ucm fixes.

See #1849
2021-12-16 15:07:05 +01:00
Wim Taymans
de12e8dd2c pulse-server: improve fix_* handling
When we have a fix_* flag set, make an extra format description with the
wildcards. This makes it possible for the session manager to fall back
to something when selecting a target and format.

Also only advertize the valid pulseaudio formats for the wildcards.

Fixes #1912
2021-12-16 12:56:19 +01:00
Wim Taymans
12cc3b34b1 pulse-server: implement fix_* fields
Use wildcards for the format/rate/channels when the fix flags are
set in the client.

See #1912
2021-12-16 12:24:59 +01:00
Wim Taymans
ee0fcf05c1 context: apply new quantum and rate when driver is idle
When the driver is IDLE, apply the quantum and rate immediately
so that we can use the values when starting the driver.

See #1913
2021-12-16 11:39:46 +01:00
Wim Taymans
d2ec680d3d spa: fix initializer for old GCC
Older gcc versions seem to require the members to appear in the
designated initializer in the order they are in the definition of
the struct when compiling C++.

Fixes #1910
2021-12-16 11:08:07 +01:00
Wim Taymans
738cbcf789 alsa: fix rate for EAC3
EAC3 needs to be opened in 4x the rate of the EAC3 stream, which can be
32, 44.1 or 48 KHz. Some clients already multiply but others don't.
Check here what is the case and fix it up.

Fixes #1902
2021-12-16 11:02:39 +01:00
Wim Taymans
7b26384388 Merge tag '0.3.42' 2021-12-16 09:51:21 +01:00
Wim Taymans
3cac296ee0 0.3.42 2021-12-16 09:17:48 +01:00
Wim Taymans
079e9b4aa0 impl-node: update quantum/rate only when pending changes
Only update the quantum/rate when we have a pending change.

This works around a bug in sco-source that changes the quantum
by itself but in any case, this optimization is nice to have.

See #1905
2021-12-16 09:01:28 +01:00
Wim Taymans
2104ee585e impl-node: sync current rate and quantum with position 2021-12-16 09:01:22 +01:00
Wim Taymans
f163a67b9d impl-node: don't update rt.position directly
When moving a driver to another, move the quantum and rate to the
current_ fields so that they are applied when the next cycle starts
instead of during the cycle.
2021-12-16 09:01:13 +01:00
Wim Taymans
311210d005 Revert "module-echo-cancel: schedule source and playback last"
This reverts commit 0d422f00dd.

Fixes #1894
2021-12-16 09:01:06 +01:00
Barnabás Pőcze
03f0a7c9ba pipewire: module-session-manager: harmonize type of change_mask
The `pw_*_info` structures in core pipewire all have 64-bit change
masks. Convert the change masks in the session manager extension
to 64-bit as the differing sizes can cause problems.

This introduces an API and ABI break unfortunately, but due to
the limited number of users of the session manager extension,
it was deemed safe.

See wireplumber#49
2021-12-16 09:00:54 +01:00
Torkel Niklasson
8abd6b3fe4 protocol-native: change some warnings to infos
Errors caused by EPIPE/Connection reset by peer should not cause an
error in the pipewire log, but rather an info.
2021-12-16 09:00:01 +01:00
Wim Taymans
65b2405262 pulse-server: track quantum and update tlength
Keep track of the current quantum and recalculate the tlength in the
same way that pulseaudio does.

Send a bufferattr changed message to a client when we change the
parameters.

This fixes the case where the quantum is increased and there needs to be
more buffering to keep the stream going.
2021-12-16 08:59:43 +01:00
Wim Taymans
c468dbebbb pulse-server: update the in_prebuf state
Move out of prebuf when we reach the prebuf amount of data. Go back to
prebuf when we run empty.
2021-12-16 08:59:32 +01:00
Wim Taymans
d3e74a49e7 pulse-server: increase buffer size
Because we keep everything in a ringbuffer and provide exactly the
required amount of data, we can use 1/4 buffers.
Also increase the buffer size. We don't want to limit the buffer size
to the negotiated tlength because it can be increased later. Instead
scale it to the max quantum size (8192) with a max resample rate of 32.
2021-12-16 08:59:28 +01:00
Wim Taymans
774fd3d4c5 doc: Add module-raop-discover 2021-12-16 08:59:23 +01:00
Wim Taymans
cf1d09d0cc Revert "pulse-server: always ask for more data when underrun"
This reverts commit e1576c53d4.

This is not quite right, it seems to break orca and qemu audio.

See #1900
2021-12-16 08:59:17 +01:00
Wim Taymans
d79f9aa76e module-raop: fix zeroconf copy and paste 2021-12-16 08:59:05 +01:00
Hendrik Borghorst
205774f3ab jack: Disconnect owned links on jack_deactivate
As per JACK API description the call to jack_deactivate should
disconnect all ports because an inactive client can't have connections.

This disconnect is missing in the current API and results in left-over
links after the call and malfunction to clients (e.g. Music Player
Daemon).

To fix it this commit goes through the list of links to owned ports and
disconnect them.

Signed-off-by: Hendrik Borghorst <hendrikborghorst@gmail.com>
2021-12-15 15:44:28 +00:00
Jonas Holmberg
6aeb640e31 tests: Add pipewire-alsa stress test
Add test that opens, prepares and closes the alsa pcm device in several
threads simultaneously in an infinite loop.
2021-12-15 16:13:08 +01:00
Wim Taymans
c97d489929 impl-node: update quantum/rate only when pending changes
Only update the quantum/rate when we have a pending change.

This works around a bug in sco-source that changes the quantum
by itself but in any case, this optimization is nice to have.

See #1905
2021-12-15 10:45:48 +01:00
Wim Taymans
c903c2ca08 impl-node: sync current rate and quantum with position 2021-12-14 20:47:36 +01:00
Wim Taymans
dbe61af543 impl-node: don't update rt.position directly
When moving a driver to another, move the quantum and rate to the
current_ fields so that they are applied when the next cycle starts
instead of during the cycle.
2021-12-14 17:05:38 +01:00
Wim Taymans
aefb527a0c Revert "module-echo-cancel: schedule source and playback last"
This reverts commit 0d422f00dd.

Fixes #1894
2021-12-14 16:52:16 +01:00
Barnabás Pőcze
e6e27fe74c pipewire: module-session-manager: harmonize type of change_mask
The `pw_*_info` structures in core pipewire all have 64-bit change
masks. Convert the change masks in the session manager extension
to 64-bit as the differing sizes can cause problems.

This introduces an API and ABI break unfortunately, but due to
the limited number of users of the session manager extension,
it was deemed safe.

See wireplumber#49
2021-12-14 15:15:55 +00:00
Torkel Niklasson
10755ff115 protocol-native: change some warnings to infos
Errors caused by EPIPE/Connection reset by peer should not cause an
error in the pipewire log, but rather an info.
2021-12-14 14:54:13 +00:00
Wim Taymans
1f4254b344 pulse-server: track quantum and update tlength
Keep track of the current quantum and recalculate the tlength in the
same way that pulseaudio does.

Send a bufferattr changed message to a client when we change the
parameters.

This fixes the case where the quantum is increased and there needs to be
more buffering to keep the stream going.
2021-12-14 15:48:54 +01:00
Wim Taymans
6b81be5ac3 pulse-server: update the in_prebuf state
Move out of prebuf when we reach the prebuf amount of data. Go back to
prebuf when we run empty.
2021-12-14 15:47:19 +01:00
Wim Taymans
fd4ea442d9 pulse-server: increase buffer size
Because we keep everything in a ringbuffer and provide exactly the
required amount of data, we can use 1/4 buffers.
Also increase the buffer size. We don't want to limit the buffer size
to the negotiated tlength because it can be increased later. Instead
scale it to the max quantum size (8192) with a max resample rate of 32.
2021-12-14 15:42:19 +01:00
Barnabás Pőcze
57dae3e2b3 spa: libcamera: call get() instead of fd()
libcamera commit 560f5cf998646ddc54a20dc1c7326012834d3204
renamed the `fd()` method on `SharedFD` to `get()`.

Adjust the libcamera plugin accordingly.
2021-12-14 09:52:05 +00:00
Wim Taymans
128f80dd6b doc: Add module-raop-discover 2021-12-14 10:47:41 +01:00
Wim Taymans
8caab44782 Revert "pulse-server: always ask for more data when underrun"
This reverts commit e1576c53d4.

This is not quite right, it seems to break orca and qemu audio.

See #1900
2021-12-14 10:27:01 +01:00
Wim Taymans
33f3a987ec module-raop: fix zeroconf copy and paste 2021-12-13 11:31:23 +01:00
Wim Taymans
717fb64e4e 0.3.41 2021-12-13 09:35:30 +01:00