Commit graph

8006 commits

Author SHA1 Message Date
Barnabás Pőcze
8ed46a283f treewide: meson.build: use project_{build,source}_root()
Use `meson.project_{build,source}_root()` instead of
`meson.{build,source}_root()` because those functions
do not work as expected when used inside a subproject,
and they have been deprecated in meson 0.56.0.
2021-12-28 18:37:18 +01:00
Barnabás Pőcze
b666edde78 daemon: meson.build: use get_variable()
Use `get_variable()` on the dependency instead of `get_pkgconfig_variable()`
as that has been deprecated in meson 0.56.0.
2021-12-28 18:37:10 +01:00
Barnabás Pőcze
a9225d3150 meson.build: use project_{build,source}_root() in devenv
The paths are calculated relative to the project root,
so use the appropriate functions to retrieve it
instead of using the current build/source directory.
2021-12-28 18:35:44 +01:00
Barnabás Pőcze
248b8c40a3 meson.build: require meson 0.56.0 2021-12-28 18:35:12 +01:00
Barnabás Pőcze
f090fd86e2 meson.build: remove unnecessary import
The "gnome" meson module is not used, do not import it.
2021-12-28 18:34:54 +01:00
Barnabás Pőcze
b656a09ae5 man: meson.build: remove unnecessary variables
The `top_srcdir` and `top_builddir` variables are not used
in any of the man page templates. Remove them.
2021-12-28 18:34:54 +01:00
Barnabás Pőcze
92a259470c spa: meson.build: only look for libcamera under one name
Commit d06a2e2140
added support for finding libcamera under two different
names. However, due to breaking changes in libcamera[1],
the current codebase only supports the latest version,
thus drop support for the old name.

[1]: see commit 57dae3e2b3
2021-12-28 18:34:54 +01:00
Barnabás Pőcze
2b110af366 treewide: meson.build: use dependency variable for SPA
Use `spa_dep` everywhere instead of `spa_inc`,
and remove `spa_inc` altogether.
2021-12-28 18:34:06 +01:00
Barnabás Pőcze
0753e992b8 pulse-server: improve reference counting of samples
Previously, when a sample is "committed" from an upload stream,
its reference count is set to 1. This is problematic if,
when the sample is committed for a second time, there are
streams playing the sample as the reference count will go out
of sync.

The problem can be easily triggered, especially with longer samples:

   pactl upload-sample a-long-sample.ogg
   pactl play-sample a-long-sample
   pactl play-sample a-long-sample
   pactl upload-sample a-long-sample.ogg  # while playing

When the first stream finishes playing, it will free the sample,
which can cause problems e.g. for the second stream playing the
sample at that very moment.

Fix that by decoupling the buffer from the sample and making
the buffer reference counted. And remove the reference counting
from the samples as it is no longer needed.

Futhermore, previously, the reference counts were ignored
when the removal of a sample was requested. That is fixed
as well.

The previous issue can be triggered easily as well:

  pactl upload-sample a-long-sample.ogg
  pactl play-sample a-long-sample
  pactl remove-sample a-long-sample      # while playing

Fixes #1953
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
0e75b3fa0f pulse-server: handle if the module is destroyed while loading
Create a new event for modules ('destroy') which is emitted from
`module_free()`. It is used by the module loading logic, to handle
when a module is destroyed without properly loading first.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
bd5a715200 pulse-server: rework module loading
Store the modules whose load has been initiated by a particular
client in the `pending_modules` list of the client. When the
client disconnects, "detach" the client from the pending module
objects. This way the reference count need not be increased
for asynchronous module loads.

Furthermore, if the module can load synchronously, do not create
the pending module object at all.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
6f412236d5 pulse-server: stream: only remove from list if pending
Only call `spa_list_remove()` in `stream_free()` if the
stream is pending. `spa_list_remove()` does not reinitialize
the list node, therefore calling `spa_list_remove()` again
after the stream has been removed from the pending list
will corrupt the pending list of the client.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
043934655a pulse-server: client: add 'disconnect' event
Have the clients emit a 'disconnect' event when they are
being disconnected.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
2d4febaba1 pulse-server: client: do not drop partially sent messages
If the first message has already been partially sent, do not
drop it when looking for redundant messages.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
4678ea06a0 pulse-server: client: restructure message handling
Move all I/O event source modifications into client.c.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
5ef9deae83 pulse-server: client: do not queue messages after disconnect
Do not queue messages to be delivered to a client if
that client has already disconnected.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
d939fa5b1c pulse-server: server: use spa_strstartswith() 2021-12-26 19:37:41 +00:00
Barnabás Pőcze
cc12188763 pulse-server: move parts of stream creation
Move some portions of the client creation logic into stream.c
so that it is easier to keep it in sync with `stream_free()`, etc.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
6d2e6fde75 pulse-server: move parts of client creation
Move some portions of the client creation logic into client.c
so that it is easier to keep it in sync with `client_free()`, etc.
2021-12-26 19:37:41 +00:00
Barnabás Pőcze
9c218b2d08 pulse-server: remove unnecessary NULL checks
`free()` and `pw_properties_free()` already include a NULL
check before proceeding.
2021-12-26 19:37:41 +00:00
Gleb Popov
089d7726dc Enable v4l2 and raop Meson options on the FreeBSD CI. 2021-12-26 17:43:23 +03:00
Gleb Popov
014881ca32 Add Meson logic to properly locate OpenSSL on FreeBSD. 2021-12-26 17:43:23 +03:00
Gleb Popov
f70dd7fa0c Use real sched_getcpu() implementation on FreeBSD 14. 2021-12-26 17:43:23 +03:00
Gleb Popov
f434876a5c module-raop-sink.c: Fix compilation error on FreeBSD. 2021-12-26 17:43:17 +03:00
Wim Taymans
65aadeb2d7 meson: use c++17 as default to compile libcamera
Fixes #1940
2021-12-24 17:56:37 +01:00
Wim Taymans
4c0bba953a jack: avoid metadata updates to monitor nodes
Because there is no difference in the node id of the monitor and
the sink carla has problems.

See #1945
2021-12-24 11:30:56 +01:00
Wim Taymans
1f4d3b0a1b jack: encode monitor uuid with extra bit
So that we can make a difference between monitor and sink uuid.

See #1945
2021-12-23 12:25:59 +01:00
Wim Taymans
08b18b9da4 pulse-server: use partial data as missing/played for
When we can't fill a complete block, report the amount of data that we
used in missing/played instead of the complete missing part.

Fixes audio breaking up when looping in mpv.

Fixes #1132
2021-12-23 11:38:54 +01:00
Wim Taymans
3de9d3df3b pulse-server: use safer spa_scnprintf
This clamps to the max size of the input buffer so that we don't write
the next item past the allocated space.
2021-12-22 21:34:29 +01:00
Wim Taymans
2905635de3 pulse-server: increase channel name length
, and AUX11 and the \0 need at least 8 chars, 6 chars will truncate
after AUX1 and leave an invalid channel map.
2021-12-22 21:15:46 +01:00
Wim Taymans
c1a0a602a5 alsa-plugin: do correct boundary check
The hw_ptr must be wrapped at the boundary value, not after.

See #1941
2021-12-22 20:03:13 +01:00
Wim Taymans
f5908dbddf impl-node: start sync after reposition
After we get a reposition request, bring the state to the SYNC state
again so that clients can align with the new position.

Fixes a problem with reposition when using the jack transport.

Fixes #1907
2021-12-22 19:53:28 +01:00
Wim Taymans
62660c1e87 audioconvert: make buffers larger
See #1781
2021-12-21 18:35:53 +01:00
Barnabás Pőcze
871ba61228 spa: pod: parser: add null terminator
If the supplied buffer has smaller (or equal) size than the
length of the string, then `strncpy()` will not place a null
terminator in the buffer.

Fix that by always setting the last byte of the buffer to zero.
2021-12-21 17:05:25 +01:00
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