Commit graph

4493 commits

Author SHA1 Message Date
Wim Taymans
d2f8cd2114 pulse-server: relax some warnings
Don't emit warnings for EPIPE and ECONNRESET when received from
recv. Some apps just disconnect violently.

Fixes #2141
2022-02-17 16:03:55 +01:00
Wim Taymans
c5c9ecdd87 spa: improve the AEC interface
Place the methods on the interface so that we can call them.
Rename create to init because that is what it does.
Add support for listener and events so that we can signal property
changes later.
2022-02-16 16:18:18 +01:00
Joakim Olsson
9386c70b3a module-echo-cancel: Move backends to dynamic libaries
Move all backends to dynamic libaries loaded with spa_plugin_loader so
new backends not needs changes in pipewire or pipewire dependency to
external code

Change-Id: I702ce047598d0c318d6dc6ac8248062a5c12f643
2022-02-15 15:45:46 +00:00
Barnabás Pőcze
762a523098 pipewire: conf: initialize return value
In some cases it is possible for `pw_context_conf_section_for_each()`
to not set `res` at all, which leads to an indeterminate value being returned.

Fix that by setting `res` to 0 initially.
2022-02-15 10:06:26 +01:00
Pauli Virtanen
2e3c749a01 pulse-server/combine-sink: mark loaded after streams appear
module-combine-sink should become loaded only after its input stream,
and all explicitly specified output sink stream nodes appear.  Since
output sinks may appear on the manager after a delay, wait for them only
up to a timeout, and fail load after that.

Fail load if there are errors in input stream, or in an explicitly
specified output.

This is needed for Zoom sound sharing to work. Pulseaudio additionally
fails the module load if streams fail to connect, but we do not do that
here at the moment.
2022-02-15 06:28:54 +00:00
Pauli Virtanen
77e50d2dfe pulse-server: sync manager before module unload completion
Operations sync manager, so use that.

On Pulseaudio, module unload is async procedure. However, this race
condition may be hard to hit in practice, whereas on pipewire-pulse it's
not hard. E.g. Zoom appears to assume that modules are unloaded
synchronously.
2022-02-15 06:28:54 +00:00
Pauli Virtanen
e737e14e8b pulse-server: sync client manager before returning from LOAD_MODULE
Sync client's manager, before returning from module load, also for async
module loads.  This is because the module load may have its own core, so
even though it has made changes on server, the client manager might not
see them yet.

Fix this by syncing client->manager before operation return.
2022-02-15 06:28:54 +00:00
Wim Taymans
fa484f346e raop-sink: use default latency of 2 seconds
See #2131
2022-02-13 18:41:01 +01:00
Pauli Virtanen
01a83a1362 pulse-server: make some modules load-once
Add mechanism for allowing some modules to be loaded only once.

Mark always-sink, raop-discover, switch-on-connect, zeroconf-discover as
such.
2022-02-13 17:50:54 +02:00
Pauli Virtanen
f5d47c079e conf: fix fork/execvp/waitpid usage
In context.exec after forking, if execvp returns we have to exit since
we're in the child process.

To avoid zombies, either SIGCHLD need to be handled/ignored, or
double-fork to create orphan processes. This is in library code, so it
seems best to just double-fork.
2022-02-13 16:48:26 +02:00
Pauli Virtanen
0b40d36a14 pulse-server: load module-always-sink on startup
Load fallback sink on startup as a Pulseaudio module, so that it is
easier to disable when necessary.
2022-02-13 14:17:48 +02:00
Pauli Virtanen
04cff777af pulse-server: add module-always-sink
It just loads/unloads libpipewire-module-fallback-sink.
2022-02-13 13:45:17 +02:00
Pauli Virtanen
8e63aa3d10 pulse-server: fix some error checks in modules
These should check if the previous pw_manager_new failed.
2022-02-13 13:40:31 +02:00
Pauli Virtanen
02e6f9fbca module-fallback-sink: add dynamically appearing fallback sink
Add a module for a fallback dummy sink, which appears dynamically when
no other sinks are present.

Enable it for pipewire-pulse, because Pulseaudio will also show
dynamically a dummy sink.
2022-02-13 09:54:55 +00:00
Wim Taymans
a6035dc4c0 pulse-server: convert node id to index in sample reply
See #2129
2022-02-13 09:56:43 +01:00
Wim Taymans
db6b7f6848 profiler: add force rate and quantum to latency
Overrite the node.latency with their forced values when available.

This will show the forced values in pw-top
2022-02-11 12:24:16 +01:00
Wim Taymans
613c0a2558 proxy: emit a warning when listener was not removed
Emit a warning when the listener was not removed now that most places
are fixed. Not removing a listener might fail to call the removed
callback and leave things in a broken state.
2022-02-09 16:34:06 +01:00
Wim Taymans
e82f775fb3 tools: remove listeners 2022-02-09 16:30:13 +01:00
Wim Taymans
cd361cb1b3 client-node: remove MAX_MIX limit
There is no limit anymore
2022-02-09 16:12:17 +01:00
Wim Taymans
f1788d0552 filter: remove unused define for MAX_PORTS 2022-02-09 16:10:32 +01:00
Wim Taymans
4e1e9aa8e7 filter: remove port limit
Use a map to allocate and keep track of port numbers.
2022-02-09 16:04:57 +01:00
Wim Taymans
f743aecd23 map: scale extend with the item size as well 2022-02-09 15:17:37 +01:00
Wim Taymans
9bebad6ed3 client-node: remove limit on ports
Use a pw_map to keep track of the ports by index so that we don't
have an upper limit on the node ports anymore.
2022-02-09 15:11:47 +01:00
Wim Taymans
d0d924c33c client-node: improve port handling
Index the ports by using the direction and port id instead of doing
conditional lookups in 2 arrays.
2022-02-09 12:41:49 +01:00
Wim Taymans
3db14600b2 remove some listeners 2022-02-09 12:33:52 +01:00
Wim Taymans
50c5485efc proxy: don't remove the hooks, but report them leaking
When a client forgets to remove a hook, report them leaked in
the debug log. This is not a problem because we don't usually
add our own removed hook for proxies.

The problem is that we can't forcibly remove them with _clean()
from _destroy() because the hooks might be emitting the removed event
or the object listener. We could try to remove them in the final
unref but it seems some apps free their data before that and then
we unref invalid memory.
2022-02-09 12:22:14 +01:00
Wim Taymans
5fd427b86a client-node: remove preallocated mix entries
Just allocate the dynamically, which allows us to remove the limit.
2022-02-09 09:23:52 +01:00
Wim Taymans
a868122c40 client-node: don't remove mix twice
The mix is added to a list in pw_impl_port_init_mix() and removed
again in pw_impl_port_release_mix().
2022-02-09 09:21:46 +01:00
Wim Taymans
fae7a1f592 jack: use node.lock-quantum by default
As soon as a JACK app is started, the automatic quantum change is
disabled. This means no pulse/alsa app can change the quantum.

The only way to change the quantum is with node.force-quantum or
with the settings metadata.

This means only a JACK buffersize change (usually controlled from the
JACK app, such as in ardour) or a metadata change (from the command
line) can modify things. Both of those are usually caused by a user
action.

For JACK apps where the quantum is allowed to change automatically,
explicit rules need to be placed in the config.
2022-02-08 18:35:12 +01:00
Wim Taymans
9acae229ab context: when force-quantum, remove lock-quantum
If a node (or metadata) forces a quantum, remove any nodes that
requested a lock-quantum so that we can change the quantum to the new
forced one.

This makes it possible to run jack clients with node.lock-quantum while
still allowing them to change the quantum qith node.force-quantum.
2022-02-08 15:36:54 +01:00
Wim Taymans
afc88a12e5 tools: cleanup up printf
Make all tools output to stdout (pw-mon mostly) so that we can pipe the
output around.
Send errors to stderr.
fprintf(stdout, ...)  -> printf(...)
setlinebuf for stdout so that pipe works better.

See #2110
2022-02-07 17:03:46 +01:00
Wim Taymans
136989eaa6 pulse-server: Make node.description
If no node.description is given in the Properties, use the node.name to
make a nicer name.

Fixes #2086
2022-02-06 18:57:44 +01:00
Wim Taymans
cec420478a modules: fix ladpsa source properties
Put the properties on the right stream.

See #2086
2022-02-06 18:57:44 +01:00
Wim Taymans
9ec782630c module: fix argument parsing
Skip spaces before the key. When the previous key ends with a ' or when
there are 2 spaces between keys, the key includes the whitespace
otherwise.

See #2086
2022-02-06 18:57:44 +01:00
Barnabás Pőcze
60b110ff93 pulse-server: rename facility argument to type
The `facility` argument is actually used for
the type of the event, not its facility.
2022-02-06 01:25:02 +01:00
Barnabás Pőcze
3bd40f976f pulse-server: validate subscription mask 2022-02-06 01:12:31 +01:00
Barnabás Pőcze
514f138ec3 pulse-server: client: drop unused argument 2022-02-06 00:49:12 +01:00
Wim Taymans
31159f418f pulse-server: fix compilation... 2022-02-04 17:58:27 +01:00
Wim Taymans
27a8c4ad13 pulse-server: improve module id in instrospect
For the modules that we load internally, place a pulse.module.id
property on the nodes.

If there is no module.id property on nodes, try to use the
pulse.module.id when introspecting. We should not remap those to
serial numbers.

Fixes #2101
2022-02-04 17:47:53 +01:00
Wim Taymans
3b26af32d0 jack: add an option to display default device as system: 2022-02-04 17:06:54 +01:00
Wim Taymans
143fadf68e pulse-server: also remap module property keys and values
When loading a module, remap the pulseaudio properties to pipewire ones
for consistency.

move the media-roles to remap, because it's more about remapping between
pa and pw.

Fixes #2076
2022-02-04 15:15:42 +01:00
Wim Taymans
8c10080324 pulse-server: make sure we don't exceed maxlength
Make sure the various buffer attributes don't exceed maxlength.
Add some SPA_ROUND_UP and SPA_ROUND_DOWN macros.

Fixes #2100
2022-02-04 11:59:57 +01:00
Wim Taymans
877dc77645 conf: move rule matching to config
And remove duplicated code. This is generally useful and sufficiently
generic API to include.
2022-02-04 10:43:31 +01:00
Barnabás Pőcze
cc73053512 treewide: meson.build: use feature.allowed()
Since meson 0.59.0, a feature object has an `allowed()`
method which returns true when the feature is set to
'enabled' or 'auto'.

Utilize that instead of the previously used

  not feature.disabled()
2022-02-04 00:15:59 +01:00
Barnabás Pőcze
15e7a61aa7 treewide: only define feature macros when the feature is available
Most feature checks already use #ifdef, and do not care about
the value of the macro. Convert all feature checks to do that,
and simplify the meson build scripts by replacing

  if cond
    cdata.set('X', 1)
  endif

with

  cdata.set('X', cond)
2022-02-04 00:15:59 +01:00
Barnabás Pőcze
9afffc1815 meson.build: only set HAVE_DBUS once
HAVE_DBUS is already set in the top-level meson.build file.
2022-02-04 00:15:59 +01:00
Wim Taymans
ae077a4967 doc: update with config overrides info 2022-02-03 17:31:01 +01:00
Wim Taymans
7ac809618e pw-link: improve help and error messages
See #2089
2022-02-03 16:39:52 +01:00
Wim Taymans
a947faeaa0 pw-link: clarify -L option
-L is enabled by default, unless -m is specified.
2022-02-03 16:30:06 +01:00
Wim Taymans
b5cd6d02fd pw-link: fix -L comment 2022-02-03 16:22:21 +01:00