Commit graph

8328 commits

Author SHA1 Message Date
Barnabás Pőcze
7b0f22636f meson.build: remove unused feature macros 2022-02-04 00:15:59 +01:00
Pauli Virtanen
97a5fe80c1 spa/alsa-udev: fix /proc/asound handling without CONFIG_SND_VERBOSE_PROCFS
For kernels compiled with CONFIG_SND_VERBOSE_PROCFS=n, the pcmXX
/proc/asound entries do not exist.  In that case, the "device busy"
check cannot be done, but we should still check existence of PCM devices
correctly.

Count the number of PCM devices from /dev/snd, which should work also
without /proc/asound or /sysfs/class/sound.
2022-02-03 18:28:25 +00: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
Wim Taymans
76417fd2a6 alsa: use MONOTONIC clock for tstamp 2022-02-03 16:22:09 +01:00
Wim Taymans
7480d09589 alsa: update test-timer
Remove the bandwidth reduce, we don't do that.
Clamp large errors.
Add htimestamp mode, which seems more stable.
2022-02-03 16:22:09 +01:00
George Kiagiadakis
ee2e6412d3 pipewiresink: set a default channel map if the number of channels is fixed
This allows remaping streams using pipewiresink to match the channel layout
of the target device
2022-02-03 15:10:25 +02:00
Wim Taymans
bdd407fe66 0.3.45 2022-02-03 12:24:24 +01:00
Wim Taymans
3a5c2ec623 jack: exit do_sync when in error
When we are already in error, return the error right away.
2022-02-03 12:01:30 +01:00
Wim Taymans
7506d12b07 examples: filter can return NULL buffers 2022-02-03 11:15:46 +01:00
Wim Taymans
0659f090fc filter-chain: add FL to FL-FR duplication 2022-02-03 11:03:24 +01:00
Wim Taymans
92e58eeb4f link-factory: allow usage without a client
So that it can be used in the config files.

Fixes #2095
2022-02-02 21:34:23 +01:00
Wim Taymans
1a911a9ccd resource: allow NULL resource in error
And then log en error instead.
We can remove some awkward patterns in modules.
2022-02-02 21:33:33 +01:00
Wim Taymans
8aea38e81a resource: fix log topic 2022-02-02 21:32:28 +01:00
Wim Taymans
336bc0eee5 log: add pw_logtv macro 2022-02-02 21:31:49 +01:00
Pauli Virtanen
b369401c8e spa/alsa-udev: retry busy devices on inotify close event, not timeout
Alsa device acp probe results to missing profiles if some PCM devices
are busy. Currently, we retry based on a timeout and give up after some
retries. However, exposing cards with missing profiles is never
useful.

Never expose cards if some PCM devices are busy. Instead, retry adding
device on inotify fd close events, which arrive when some process has
closed a PCM device.

When probing for devices in alsa-udev, check via /proc to avoid inotify
busy loop.
2022-02-02 16:43:54 +00:00
Wim Taymans
4341d27c2c pulse-server: don't make fake channels for iec958
Just leave the channels as they were.

See #1442
2022-02-02 17:41:23 +01:00
Wim Taymans
33607f769c pulse-server: don't update channels when unset 2022-02-02 17:40:57 +01:00
Barnabás Pőcze
e63dee6075 pulse-server: check reference count of sample when freeing it
When the pulse server context is being freed, only a single reference
should be alive to each sample because the pending samples
are all destroyed beforehand.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
f181210b29 pulse-server: properly unload modules
Instead of simply calling `module_free()`, actually unload
the modules when the pulse server context is being freed.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
a79bb60754 pulse-server: clean up everything when the context is destroyed
Clean everything up when the context is destroyed to avoid
problems stemming from the destruction order of objects
in the context.

Furthermore, free messages after all clients have been freed
because `client_free()` may very well call `message_free()`
which would lead to memory leaks if `impl->free_messages` were
processed first.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
1bf00720e3 pulse-server: do not manage client lifetime during stream cleanup
A stream's lifetime is tied to that of the client, it cannot outlive
the client object. Streams also do not increase the client's reference
count. It is not possible for a stream to exist after the corresponding
client has been destroyed.

Hence it is not necessary to manage the client's reference count
or lifetime in `do_destroy_stream()`. All works related to a particular
stream are cancelled in `stream_free()`, which is called
before the client is destroyed.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
194c0f9c99 pulse-server: stream: remove done flag
When the `done` flag was first added in
9f9be7d7f2, it was
actually needed because cleanup was implemented
using a per-client eventfd which was signalled when
something related to the particular client needed
to be freed. The function that ran, then, checked
each stream's `done` flag, and freed them as necessary.

However, since c70a5de526,
the stream cleanup is done using a work queue, and as
a consequence, the `done` flag is no longer needed.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
4426da6a62 pulse-server: client: remove disconnecting flag
When the `disconnecting` flag was first added in
d44fdabea1, a client's
streams were not explicitly destroyed when it was freed,
instead, only the client's pw_core was disconnected,
which then caused all related streams to be destroyed.

Thus there needed to be a way to determine why the stream's
state changed to PW_STREAM_STATE_UNCONNECTED as it may have
been because the client is disconnecting or because the
stream has been "killed" in some other way.

The `COMMAND_{PLAYBACK,RECORD}_STREAM_KILLED` command
only needed to be sent to the client in the second case.

However, at the moment, all streams of a client are explicitly
destroyed before it's pw_core is disconnected. This makes the
`disconnecting` flag unnecessary, thus it can be removed.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
f5e561c2fe pulse-server: module: remove unused client argument
None of the modules use the `client` argument in their
unload callbacks. Remove it.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
bc2914b3e9 pulse-server: pending-sample: move reference counting
Move the reference counting from `pending_sample_free()`
into `on_sample_done()` so that the client's references
are managed in a single place.

The reason why `pending_sample_free()` cannot simply call
`client_unref()` is that `client_free()` may be called from
`manager_disconnect()` regardless of the reference count,
and, in turn, `pending_sample_free()` may be called,
which could then lead to a recursive call to `client_free()`.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
29a288ebae pulse-server: pending-sample: remove done flag
The `done` member of the `pending_sample` struct is only ever
set, but never read. Remove it.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
9447dbe4f8 pulse-server: remove unnecessary include 2022-02-02 15:40:43 +00:00
Barnabás Pőcze
5db2c6cc32 pulse-server: simplify a condition
`a || (!a && b)` equals `a || b` due to the
short-circuiting nature of `||` and `&&`.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
6d0075b4e9 pulse-server: client: cancel related work queue jobs 2022-02-02 15:40:43 +00:00
Barnabás Pőcze
78aaa0a3dd pulse-server: client: move to cleanup list on detach
Move a client to the `impl->cleanup_clients` list right
after it has been removed its server's `clients` list.
2022-02-02 15:40:43 +00:00
Barnabás Pőcze
d2edb1ab16 pulse-server: client: do not leave dangling pointers behind 2022-02-02 15:40:43 +00:00
Wim Taymans
f38837d9e2 conf: look in conf.d directories and merge all sections
Load all sections found in all prefix/name.conf.d directories and add
them to the config as overrides.
If for example jack.conf is loaded, check in:

  /usr/share/pipewire/jack.conf.d/
  /etc/pipewire/jack.conf.d/
  $XDG_CONFIG_HOME/pipewire/jack.conf.d/
     or ~/.config/pipewire/jack.conf.d/

For .conf files and also process the sections. The files are processed
in sorted order so 10-remap.conf can be used to specify the order.

When processing a section, first the global conf is applied and then the
overrides in their order.

This makes it possible to override properties or add modules,
objects and custom matching rules.

Since the merging logic is handled either internally or by the
application, we can add more syntax later to do more complex merges.

See #207
2022-02-02 14:58:15 +01:00
Wim Taymans
92e851f61b conf: improve debug 2022-02-02 12:41:36 +01:00
Wim Taymans
58ebe0f88a conf: Parse the whole config with properties
There is no need to call the callbacks when reading the config file,
just store all properties.
We're only going to extract one when iterating later.
2022-02-02 12:37:49 +01:00
Wim Taymans
9bac90882d test: disable broken test
When a prefix is given, the file should not be found.
2022-02-01 18:15:16 +01:00
Wim Taymans
f273e2a716 conf: emit callback for config sections
Instead of reading all config section in properties, emit a callback
for each section, allow for filtering on a particular section as
well. In the callback, update the section value in the properties.

Deprecate get_conf_section(), it can't support multiple section
updates.
2022-02-01 17:16:33 +01:00
Wim Taymans
5839400aa0 context: implement prop updates with for_each 2022-02-01 16:51:59 +01:00
Wim Taymans
432f464297 conf: implement match rules with conf_section_for_each 2022-02-01 16:35:16 +01:00
Wim Taymans
0ac87a14cd context: move context method to right header file. 2022-02-01 16:30:43 +01:00
Wim Taymans
d6218b65ab conf: parse the context sections with iterator
Make a new function that calls a callback for each config section
and use that to parse the config sections internally.
2022-02-01 16:27:21 +01:00
Wim Taymans
50de4b1886 conf: add some properties in the conf
Add the path, prefix and name in the config properties.
2022-02-01 15:55:17 +01:00
Wim Taymans
2b569861b1 conf: refactor path generation
Make different methods for the different paths to search.
2022-02-01 15:37:48 +01:00
Wim Taymans
2013fb56cf conf: refactor abs path
We can simplify the check by shifting the prefix and name and use
the same code for both the config and state path.
2022-02-01 15:25:48 +01:00
Wim Taymans
65c487564b context: add a function to merge config properties
Add a function that takes a section and merges the properties into
a target properties. Replace some usage of get_config_section().
2022-02-01 15:11:45 +01:00
Wim Taymans
6149c01b51 jack: pass size_t as len 2022-02-01 13:28:10 +01:00
Pauli Virtanen
f32935ec8a bluez5: sco-sink: fix behavior as follower
When sink is follower, and no data to write is available, it should not
schedule a timeout, but wait for the driver to wake it up again.

Fixes process ending up busylooping in data thread as follower, under
some conditions.

Also, clean up the code to be more clear about timeout logic. Just loop
directly instead of setting timeout 1, if we need to just flush more
immediately.
2022-01-31 21:59:39 +02:00
Pauli Virtanen
4bb3ff739a bluez5: keepalive A2DP source / SCO AG dynamic node transports
When acting as SCO AG / A2DP sink, the remote end should decide when to
close the connection.  This does not work currently properly, because
stopping sources/sinks releases the transport, which causes it to go
idle, and which then destroys dynamic nodes.  The sources/sinks should
not cause the transport to be released.

Implement keepalive flag for spa_bt_transport, such that
spa_bt_transport_release does not actually release the transport when
the refcount reaches zero. Set the flag for dynamic nodes when the
transport becomes pending (remote end connects) and unset the flag when
idle (remote end disconnected, or dynamic node removed).
2022-01-31 21:59:39 +02:00