Commit graph

5302 commits

Author SHA1 Message Date
Wim Taymans
bc164814cc context: improve retry logic
Remove the useless retry logic and fail when we wrapped around
while scanning for an unused id.
2022-01-13 16:35:48 +01:00
Wim Taymans
5baab24848 global: avoid using existing global id
Add the global immediately after creating it. Make sure we only
enumerate registered globals. This way, we can already check for
duplicate ids before the global is registered.

When allocating a global id, avoid using an existing id. Move some
code around to make it easier to implement a more efficient algorithm
for collision detection.

Move the object id counter to the context.
2022-01-13 16:10:35 +01:00
Wim Taymans
3a49168f26 pulse-server: use the upper 8 bits of the id to mark things
The upper 8 bits of the object id is always 0 so we can use it to mark
our internal objects.
2022-01-13 14:54:16 +01:00
Wim Taymans
b8f8409980 global: limit the id to 24 bits
This leaves some extra bits for applications to mark things.
2022-01-13 14:53:18 +01:00
Wim Taymans
3c68476984 pw-cli: use a list for globals instead of a map
Now that the global ids are not reused we can't use an array to look up
ids.
2022-01-13 14:53:18 +01:00
Wim Taymans
bae0d16e09 global: don't reuse ids 2022-01-13 14:53:18 +01:00
Barnabás Pőcze
60818886ed pipewire: module-protocol-simple: fix inet_ntop() call
Previously, the buffer argument was a pointer which did not
point to the address portion of an AF_INET address.

See #2017
2022-01-13 13:36:04 +01:00
Barnabás Pőcze
11db00abdf pipewire: module-protocol-simple: reduce name length
A client's name is its IP address or "client <fd>", neither
of which are longer than 127 characters.
2022-01-13 13:15:44 +01:00
Wim Taymans
844eee678a filter: return NULL when no DSP buffer is available
Instead of returning the dummy empty buffer.

The dummy buffer is problematic in various ways:

1) it has a fixed hardcoded size and doesn't adapt to the quantum_limit.
2) when used as output buffer, data is written to the void with no
   indication for the application.
3) using random data as an input buffer is going to cause unexpected
   noise with no indication to the application.
2022-01-12 19:15:13 +01:00
Wim Taymans
622851001e allow scaling the quantum_limit to 65536
Make it possible to change the quantum-limit in the config file past
8192 up to 65536. This will make all plugins allocate larger buffers
so that the quantum can be increased to larger values as well,

This is interesting when dealing with higher sample rates where the
8192 sample limit will cause wakeups every 20ms at 384KHz.

See #1931
2022-01-12 18:02:40 +01:00
Wim Taymans
71028f184d settings: set the max-quantum to 2048
Allow an app to request up to 2048/48000 quantum. This will be scaled
with the selected sample rate so if the graph changes to 96000, the
quantum will be scaled to 4096. It will scale up to the hard limit of
quantum_limit.

See #1931
2022-01-12 17:58:14 +01:00
Wim Taymans
776b52749f Use configured quantum_limit instead of hardcoded value
Parse the quantum_limit parameters and use this to scale the buffers so
that they can contain the maximum allowed samples instead of the
hardcoded 8192 value.

See #1931
2022-01-12 17:50:12 +01:00
Wim Taymans
4e5ab4bcbe context: pass quantum_limit when loading plugins 2022-01-12 17:47:58 +01:00
Wim Taymans
676bed734c context: scale max_quantum and add quantum_limit
Also scale the max_quantum with the selected rate. Add a new
quantum_limit property that is the upper limit of the quantum regardless
of the sample rate, this is usually the allocated buffer size.

See #1931
2022-01-12 17:44:45 +01:00
Wim Taymans
8e3eaf7952 raop: fix errno check 2022-01-12 10:11:00 +01:00
Wim Taymans
0ad318f61c channelmix: enable normalization by default
It is probably a better default to avoid clipping when downmixing.
2022-01-11 10:40:42 +01:00
Wim Taymans
982758ffed pulse-server: calculate missing bytes differently
Based on patch from Barnabás Pőcze <pobrn@protonmail.com>

Instead of trying to keep track of the missing bytes ourselves, use the
simple tlength - avail - requested formula to request more bytes from
the client.

Fixes #1981
2022-01-10 15:08:52 +01:00
Wim Taymans
163c365340 pulse-server: implement control arg for module-ladspa
See #1987
2022-01-07 16:40:36 +01:00
Wim Taymans
6d081d5214 filter-chain: also allow control params with index
Allow specifying the control parameter by index instead of name.
2022-01-07 16:37:45 +01:00
Wim Taymans
ce8af10cfe impl-node: set signal and awake time
When a non-driver emits the ready event, set the awake and signal time
so that pw-top reports times correctly.

See #1987
2022-01-07 16:36:29 +01:00
Wim Taymans
222ef88704 pulse-server: request more data when seeking backwards
Immediately ask for more data when we seek backwards so that we don't
underrun in the next process cycle.

See #1981
2022-01-07 10:59:41 +01:00
Wim Taymans
ab425d44b8 pulse-server: after uncork, ask for missing data
When we uncork, ask for any missing data immediately so that we don't
underrun in the next process cycle.

See #1981
2022-01-07 10:41:10 +01:00
Pauli Virtanen
9eddd0474f pulse-server: show monitor sources with device.class=monitor
Pulseaudio shows monitors with device.class=monitor, so we follow.
2022-01-06 20:32:53 +00:00
Wim Taymans
25e565c34c conf: fix compiler warning about different signedness 2022-01-06 13:19:34 +01:00
Timo Gurr
814d409501 systemd: Add systemd-system-unit-dir override 2022-01-06 12:17:10 +00:00
Doğukan Korkmaztürk
adb02119b7 conf: eliminate an unnecessary narrowing conversion 2022-01-05 06:26:43 -05:00
Wim Taymans
22625fb658 pulse-server: support server config
Extend the server.address property so that you can also specify
an object per server. Add support for configuring some aspects of the
server such as max-clients and backlog.

Most importantly, the pipewire client.access can be configured per
server.

See #1960
2022-01-04 14:30:33 +01:00
Wim Taymans
611591d0fc json: add spa_json_parse_stringn()
It also checks the destination size.
2022-01-04 12:37:00 +01:00
Wim Taymans
c46113faa3 json: spa_json_get_string() writes up to len chars or fail 2022-01-04 10:42:32 +01:00
Wim Taymans
68b31d37d9 json: check spa_json_get_string() return value correctly
It is only successful when > 0.
2022-01-04 10:15:35 +01:00
Wim Taymans
13c0cbb899 pulse-server: remove unused defines 2022-01-04 10:08:54 +01:00
Wim Taymans
2f4c589d5b pw-cat: also list additional targets in record mode
Also list the sink and output stream nodes because we can also record
from them.

Fixes #1952
2022-01-03 16:59:21 +01:00
Wim Taymans
67dc97fa43 alsa: add audio.allowed-rates param
Add a construct and runtime param to limit the amount of allowed
samplerates used by the node.

Fixes #1932
2022-01-03 16:03:23 +01:00
Wim Taymans
c3725d5dde module-loopback: align stream media names to filter-chain 2022-01-03 13:14:29 +01:00
Wim Taymans
9e207a2deb filter-chain: use node.name in media.name instead of id
The node name is likely more stable when specified, which is better
because media.name is used to restore volumes.
2022-01-03 13:12:29 +01:00
Wim Taymans
81f1a6c511 module-loopback: make unique media name per stream
If not otherwise set, the media.name will be the name used when
pw_stream_new(), which is the same for all loopback streams.
This makes the session manager restore the same volume for all
loopback streams.

Do something more clever and use the node.name + suffix to make
the name unique per stream if no media.name was given.

Fixes #1942
2022-01-03 13:00:15 +01:00
Wim Taymans
35cbe4e939 buffers: make alignment optional
Make the alignment parameter optional when negotiating buffers.
Default to a 16 bytes alignment and adjust for the max cpu
alignment.
Remove the useless align buffer parameter in plugins, we always
set it to 16 anyway.
2022-01-03 12:32:26 +01:00
Doğukan Korkmaztürk
3f87741b27 context: calculate target rate only when needed
Instead of calculating the target rate and overriding it in some
conditions, calculate it only if it is necessary. This change also
eliminates a set of conditional branches that have the same outcome,
which causes clang-tidy to produce a bugprone-branch-clone warning.
2022-01-01 10:00:03 -05:00
Petros Angelatos
5054b48c9d systemd: correctly prefix systemd system units
The definition of the `systemdsystemunitdir` variable uses `rootprefix`
instead of `prefix`:

https://github.com/systemd/systemd/blob/v250/src/core/systemd.pc.in#L23

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2021-12-31 20:47:56 +01:00
Barnabás Pőcze
e35b9828d3 pulse-server: make GET_SERVER_INFO accessible without manager
For example, pulseaudio.js[1] immediately sends a
GET_SERVER_INFO request after AUTH, and only later
issues a SET_CLIENT_NAME.

See #1966.

[1]: https://github.com/janakj/pulseaudio.js
2021-12-31 02:12:03 +01:00
Barnabás Pőcze
1c3e45a584 pulse-server: add command access control
By default require that a client is authenticated and
has a manager to be allowed to run a command.

Specially:
 * AUTH requires nothing
 * SET_CLIENT_NAME and STAT only require authentication
2021-12-31 02:11:59 +01:00
Barnabás Pőcze
92abc7b7ad pulse-server: store whether the client has been authenticated
Add a new flag to the client struct which saves whether or not
the client has successfully authenticated itself.
2021-12-30 21:24:06 +01:00
Barnabás Pőcze
705ac662e3 pulse-server: use macro to generate command entries 2021-12-30 21:22:19 +01:00
Wim Taymans
2f742bb56c Revert "pulse-server: use partial data as missing/played for"
This reverts commit 08b18b9da4.

This was likely caused by a bug in mpv

Fixes #1956
2021-12-29 19:49:15 +01:00
Wim Taymans
8416d66ab3 filter-chain: improve lv2 support
Add support for Worker.
Add Options feature.
Pass support in plugin load.
2021-12-29 17:17:17 +01:00
Barnabás Pőcze
c04580a256 pulse-server: module-roc-{sink,source}: fix potential memory leaks
Two `pw_properties` objects are not freed in the error path.
Resolves Coverity issues: 1468665, 1468666, 1468667, 1468668.

Furthermore, the module argument string is also not freed.
2021-12-29 15:16:58 +01:00
Barnabás Pőcze
6d64454300 pulse-server: module-zeroconf-publish: harmonize log messages
Use lowercase letters consistently and report errors.
2021-12-28 23:56:03 +01:00
Barnabás Pőcze
7fb27098b9 pulse-server: module-zeroconf-publish: handle allocation failure 2021-12-28 23:37:53 +01:00
Barnabás Pőcze
417b2e2bf7 pulse-server: module-zeroconf-publish: remove empty line 2021-12-28 23:37:53 +01:00
Barnabás Pőcze
5421f2689e pulse-server: module-zeroconf-publish: cache service TXT records
Keep the TXT records for each service,
and reuse them when publishing, if possible.
2021-12-28 23:37:53 +01:00