Commit graph

2878 commits

Author SHA1 Message Date
Wim Taymans
8414092763 Rework profile/route handling
Add save property to Profile and Route params to notify the session
manager that they should be saved. Let the session manager only save
the Profile and Routes with the save flag.
Make pulse-server set the save flag on Profile and Route changes.
The result is that we can make a difference between user requested
changes and automatical changes and only remember the user preferences.
When a port changes availability, first check if we need to perform
a profile switch, if not select the new best port.
2021-02-22 16:51:59 +01:00
Wim Taymans
5ae92fd643 media-session: Fix saved_profile check
ID_INVALID is when the profile was not saved.
2021-02-22 10:54:55 +01:00
Wim Taymans
1c3a17362e pulse-server: fix weird property handling
There is no need to copy the properties, just pass ownership.
Make sure to always have properties for the server. Ensure we
clean up properties on error.
2021-02-21 09:43:02 +01:00
Wim Taymans
fa39cae9d3 pulse-server: we can add stream.properties as well 2021-02-20 21:06:47 +01:00
Wim Taymans
5738cb74ef Add filter and stream properties
Mostly latency but also adapter properties for streams.
2021-02-20 21:03:38 +01:00
Wim Taymans
149319819a jack: apply PIPEWIRE_PROPS after reading config
First apply config properties, then PIPEWIRE_PROPS.
We can set the node.latency in jack.conf
2021-02-20 21:02:05 +01:00
Wim Taymans
71e37f93f3 PIPEWIRE_LATENCY always overrides app settings 2021-02-20 20:59:41 +01:00
Wim Taymans
3673265ae2 policy-node: don't crash without metadata 2021-02-19 17:54:31 +01:00
Wim Taymans
72e03e3dc8 media-session: add -c option to load custom config 2021-02-19 17:48:27 +01:00
Wim Taymans
91875c1fd8 pw-cli: always output to stdout
Use spa_debug_pod because spa_debug_format outputs to stderr
2021-02-19 16:42:21 +01:00
Wim Taymans
fcf00b3d35 pulse-server: handle unsupported formats
We can only handle PCM encodings for now, fail conversion otherwise.
If we have no supported formats, return an error code.

VLC first try to send AC3 or EAC3 passthrough and then tries again
with decoded data. If we accept the encoded data we are just playing
noise.

Fixes #428
2021-02-19 15:25:32 +01:00
Wim Taymans
4b591df145 pulse-server: print encoding name in format_info 2021-02-19 14:57:11 +01:00
Wim Taymans
686524ce40 context: use the log.level from the config file
Use log.level from the config file if not otherwise set with
PIPEWIRE_DEBUG env.
Make client log.level = 0 by default to avoid spamming the console
with errors.

Fixes #725
Fixes #769
2021-02-19 12:44:03 +01:00
Wim Taymans
08ea7d5cd6 properties: ignore some property updates
Ignore property updates for keys that we manage ourselves like the
object.id, node.id etc. Otherwise a client can replace this with
their local ids and cause confusion.
2021-02-19 11:43:46 +01:00
Bryan Quigley
dd1bf796cb systemd: add sandboxing and slice similar to pulseaudio
Adds as much sandboxing as seems to work with user sessions.
Adds pipewire to session slice per https://systemd.io/DESKTOP_ENVIRONMENTS/

Inspired from https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/daemon/systemd/user/pulseaudio.service.in

Fixes: 763
2021-02-19 09:08:51 +00:00
Wim Taymans
84fc63e601 media-session: don't switch to pro-audio by default
Ignore the pro-audio profile when finding the best profile. We only
want to enable the profile when explicitly set.

Fixes #761
2021-02-18 19:51:00 +01:00
Wim Taymans
250a10cd63 conf: put "" around string with potential special chars 2021-02-18 17:21:29 +01:00
Wim Taymans
63a3811aa7 fix some warnings 2021-02-18 12:42:06 +01:00
Pauli Virtanen
2efdb78239 media-session: save and restore latencyOffsetNsec 2021-02-18 11:33:45 +00:00
Pauli Virtanen
ed9614077c pulse-server: implement node latency offset
Also add facility for storing user data on objects.
2021-02-18 11:33:45 +00:00
Wim Taymans
7053936ffd don't attempt to connect to empty remote name
Fixes jconvolver startup.

See #744
2021-02-18 10:22:39 +01:00
Wim Taymans
81ebc33b57 pw-top: period -> quantum
period has other connotations in alsa
2021-02-18 09:16:49 +01:00
Wim Taymans
c0d8edeb5a conf: improve state directory access checks
We only need RW permission on the last directory.
2021-02-17 20:21:14 +01:00
Wim Taymans
bf062e455a media-session: always remember the new route availability 2021-02-17 15:49:20 +01:00
Wim Taymans
aea79cd79c media-session: sanitize description
Because we use the description as the JACK name, remove the : so
that it looks somewhat ok in more cases.
2021-02-17 13:12:22 +01:00
Wim Taymans
60233e30a7 jack: tweak names a little
Move the Description in the main node/port name. This then matches
the device names seen in pavucontrol.
Make the port alias contain the node nick.
2021-02-17 11:36:16 +01:00
Wim Taymans
1f2ba4b55f port: set port id in properties 2021-02-17 11:15:08 +01:00
Wim Taymans
38a7333608 adapter: number unknown ports from 1 instead of 0
This makes it like what jack does.
2021-02-17 10:14:47 +01:00
Wim Taymans
3aa0a39e30 pulse-server: track volume/mute changes
When something else changes the volume of our stream, store the new
value in our volume/mute state so that we always have an up-to-date
value when we compare our volume to the desired volume.

See #721
2021-02-16 17:21:26 +01:00
Wim Taymans
6079830591 media-session: add option to configure suspend timeout
Set the property on the node and use the value when suspending the
node. a timeout of 0 disables suspend.
2021-02-16 15:41:53 +01:00
Wim Taymans
af686653a9 jack: add option to merge monitors
Make a different name for the monitor port prefix so that they
appear as different clients.
Add an option to restore the previous behaviour.

See #736
2021-02-16 13:23:47 +01:00
Wim Taymans
d1f21a939a context: make method to get config section
Applications will likely need a section of the config, not the
whole thing.
2021-02-16 13:22:42 +01:00
Frédéric Danis
0b2d3730b6 bluez5: Add HFP HF support 2021-02-15 14:46:18 +00:00
Wim Taymans
7ba9044c3d Revert "media-session: fix sm_object ownership"
This reverts commit 791a38f3fa.
2021-02-15 15:28:42 +01:00
Wim Taymans
a85be79135 Revert "media-session: when resolving duplicate objects, bind a proxy if missing"
This reverts commit 77e4fdb1e4.
2021-02-15 15:28:35 +01:00
Wim Taymans
373fd53d2e conf: fix audioconvert regex 2021-02-13 20:38:02 +01:00
Ivan
7e7f0225d4 style: Format and fix config files
Some minor formatting for recently added config files.
2021-02-13 19:20:10 +00:00
Pauli Virtanen
77e4fdb1e4 media-session: when resolving duplicate objects, bind a proxy if missing
When duplicate objects are created, the new object has missed its
registry_global event, and is missing its proxy.

In this case, bind a proxy for the new object.
2021-02-13 19:04:21 +00:00
Pauli Virtanen
791a38f3fa media-session: fix sm_object ownership
sm_object may be owned by either (i) monitors, created via
sm_media_session_create/export*, or (ii) registry, via
registry_global+bind_object.  However, registry adds the objects to its
globals list when their proxy appears, even if it does not own them.

Only owner should call sm_object_destroy which unrefs obj->handle,
because the sm_object structure is stored inside the handle's user_data
and becomes invalid afterward.

The sm_object_destroy call removes the object from the registry globals
map, so if monitor calls first, there is no problem. However, sometimes
the registry wins the race.

Previously, registry did sm_object_destroy regardless of whether it owns
the object or not, possibly causing the monitor's sm_object_destroy to
refer to freed memory. This could cause segfaults, e.g.

    CARD=XX:XX:XX:XX:XX:XX
    bluetootctl connect $CARD
    while true; do pactl set-card-profile bluez_card.$CARD a2dp-sink; pactl set-card-profile bluez_card.$CARD off; done

leads to a race between bluez5_remove_node and registry_global_remove,
and problems appear when the latter wins.  (As usual, if it doesn't
segfault, a heisenbug appears instead.)

Fix this by keeping track who owns the objects, and having registry
destroy the objects only if it owns them. Otherwise, it just removes
them from its lists.

Also call pw_proxy_unref unconditionally in sm_object_destroy, so its
asserts catch refcounting errors (although now there shouldn't be any).

***

Another problem is conflict between bound_proxy and register_global,
which generates duplicate objects with the same id.  We resolve this by
keeping the object not owned by the registry and discarding the other
one.

This fixes a memory leak, and possible consistency problems in session
modules (due to session_create events for different objects with same
id; now there will be paired session_remove ones in between).
2021-02-13 19:04:21 +00:00
Wim Taymans
b23e33c99f media-session: only replace : with space for node.nick 2021-02-13 07:17:55 +01:00
Wim Taymans
062911640c media-session: sanitize name and nick
Replace unwanted chars in the name with _. This makes it compatible
with pulseaudio names and avoids problems with regex.
Replace unwanred chars in the nick with ' '. This ensures JACK
clients don't receive ':' in the device names, which cause it to
fail when parsing the ports.

See #714 and #130
2021-02-12 20:47:41 +01:00
Wim Taymans
9074bfc23a module-rtkit: don't use dbus when disabled 2021-02-12 18:10:40 +01:00
Wim Taymans
70390a631e context: add suport.dbus option
Add a support.dbus option in the context that can be used to disable
the dbus feature.
2021-02-12 17:57:24 +01:00
Wim Taymans
2c2ba6eec3 media-session: handle missing dbus support 2021-02-12 17:55:56 +01:00
Wim Taymans
04354215b6 media-session: get the right key for properties 2021-02-12 17:28:52 +01:00
Pauli Virtanen
dfb3bff15b bluez5: fix source priority assignment 2021-02-12 16:11:56 +00:00
Wim Taymans
3cc577ddd6 v4l2: fix sink/source and output/input names 2021-02-12 16:13:00 +01:00
Wim Taymans
2a83811297 bluez: input = source, output = sink 2021-02-12 16:10:58 +01:00
Wim Taymans
13d655ceb2 conf: add and example of how to make a raw alsa device 2021-02-12 13:15:45 +01:00
Wim Taymans
58d2fe4440 man: update man page
Add PIPEWIRE_CONFIG_PREFIX environment variable as well
2021-02-12 10:33:23 +01:00