Commit graph

5884 commits

Author SHA1 Message Date
George Kiagiadakis
27cfff7965 systemd: do not specify RuntimeDirectory on the media-session service
This will just re-create /run/pipewire for no good reason; the one
in pipewire.service is enough
2021-02-24 21:15:41 +00:00
George Kiagiadakis
32512a8962 systemd: system-mode: preserve /run/pipewire after the daemon stops
/run/pipewire is initially created by pipewire.socket when it creates
the socket file, but it is owned by root with mode 0755.

In the .service unit, RuntimeDirectory=pipewire re-creates /run/pipewire
for user pipewire (owned by pipewire:pipewire, 0755) when this unit starts.
This is necessary for the pipewire daemon to be able to write the .lock file.

By default, when the service unit stops, systemd deletes this runtime
directory and therefore it also deletes the socket that is owned by
pipewire.socket. When this happens, the service is no longer
socket-activateable even though pipewire.socket is active.

RuntimeDirectoryPreserve=yes prevents the service unit from removing
this runtime directory and socket activation still works as expected
2021-02-24 21:15:41 +00:00
George Kiagiadakis
2491f56355 config: ignore module-portal load failures
When running pipewire as a system-wide daemon, module-portal
obviously doesn't load. Make it optional so that the default
config doesn't fail in system-wide mode
2021-02-24 21:15:41 +00:00
Pauli Virtanen
6114ca7c4a bluez5: fix queueing codec switches
Make queueing a codec switch work properly.  When receiving the dbus
reply, it should move to latest one. Others should be discarded.

Previously, it instead hit an assert, if there were more than two
queued.
2021-02-24 21:14:25 +00:00
Wim Taymans
8768cf1b68 jack: increase client name size
Increase the client name size and try hard not to exceed the client name
size especially when adding the Monitor suffix.
Also avoid some potentially unsafe strncpy.

See #788
2021-02-24 22:05:14 +01:00
Gleb Popov
dbc9a520ef Check for sys/mount.h and sys/vfs.h headers and include them conditionally 2021-02-24 19:29:57 +00:00
Gleb Popov
c5e42aa9db Define Linux-specific O_PATH and MAP_LOCKED flags to 0 on FreeBSD 2021-02-24 19:29:57 +00:00
Gleb Popov
3faf388821 Guard some non-portable error code defines with #ifdef's 2021-02-24 19:29:57 +00:00
Gleb Popov
af5ba6cf4c Define ENODATA if it isn't defined. 2021-02-24 19:29:57 +00:00
Gleb Popov
fd544544ab Link v4l2 plugin to libinotify on FreeBSD 2021-02-24 19:29:57 +00:00
Wim Taymans
6f26210361 media-session: simplify routing a bit
1) detect port changes
2) restore or save port changes
3) if port changes:
     check and restore the best profile
     else check and restore the best ports
4) if profile changed, check and restore best ports

See #533
See #708
2021-02-24 20:28:21 +01:00
Wim Taymans
27f85d1f52 tools: remove registry listener before destroying
Otherwise we access freed memory when we try to remove
the listener later.
2021-02-24 14:58:20 +01:00
Wim Taymans
72acd752f6 pulse-server: don't use the pending_sample after free
Destroying the sample_play will free the user_data, which is the
pending_sample info. So don't try to use the pending_sample anymore
after destroy.
2021-02-24 12:55:34 +01:00
Wim Taymans
e340a44a35 jack: fix names of our ports
Write our port name into the port.name

See #796
See #780
See #569
2021-02-23 21:11:05 +01:00
Wim Taymans
9e09461113 alsa: gracefully handle NULL params 2021-02-23 18:20:37 +01:00
Wim Taymans
1f2cb7ac67 don't crash with missing libraries 2021-02-23 17:48:57 +01:00
Ivan
217f93a317 fix: Change script shebang to support non-FHS *NIX systems (e.g NixOS) 2021-02-23 16:23:03 +00:00
George Kiagiadakis
012a68f8ef systemd: add unit files for pipewire-media-session
... and disable starting it from context.exec in the config
2021-02-23 16:21:59 +00:00
George Kiagiadakis
3a7ce9660a meson: add option to enable/disable media-session 2021-02-23 16:21:59 +00:00
George Kiagiadakis
b7c6f70ae3 systemd: add sandboxing also for the system service
Based on dd1bf796cb
and https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/daemon/systemd/user/pulseaudio.service.in

See also: #763
2021-02-23 16:21:59 +00:00
Wim Taymans
d2fb6db21f alsa: use configured rate and channels when enumerating formats
When we have a rate or channels configured, set this in the hw_params
to restrict the enumeration of the remaining parameters. If we,
for example want 8 channels, some cards restrict the formats in that
case and we don't want to enumerate impossible combinations.

Fixes #782
2021-02-23 17:17:14 +01:00
Wim Taymans
d54da879bf jack: add config option to shorten and filter names 2021-02-23 16:13:08 +01:00
Wim Taymans
43f8f39d3a pulse-server: move some config params to config file
Also make the minreq/fragsize larger by default.
2021-02-23 14:57:45 +01:00
Wim Taymans
8712cfb6a1 pulse-server: remove MIN_BLOCK
It is not really used and minreq is good enough
2021-02-23 12:29:39 +01:00
Wim Taymans
ab45b16a05 media-session: improve routing
First check all the routes to see if anything changed. If there is
a change check if we need a profile switch.
Then check all the active routes and restore state when they changed.
2021-02-23 11:09:42 +01:00
Wim Taymans
3b0fcdd525 media-session: don't save invalid route properties
When we switch away from a route, don't save the properties.
2021-02-22 17:47:04 +01:00
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
c067fd0a20 alsa: log device name in visible debug messages 2021-02-22 10:07:50 +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
Pauli Virtanen
a5dc2493df bluez5: route shouldn't list a2dp profiles when not connected 2021-02-19 21:16:27 +02: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
715a3a642a jack: handle client init error with -EIO 2021-02-19 16:10:34 +01:00
dreamer
b35969c706 script depends on bash, set bash with shebang 2021-02-19 14:33:07 +00: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
b9241b1d73 alsa: set application.name 2021-02-19 10:06:40 +01:00
Wim Taymans
44919c83fc audioconvert: keep better track of param changes
Keep track of the param changes with the user counter. Make sure to
flip the serial switch whenever a change is pending. Previously
we copied the param from the channelmixer or follower but that
did not always result in a serial change.

Fixes #764
2021-02-19 09:57:59 +01: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
Frédéric Danis
7a5a944704 bluez5: backend-native: Check volume values
The value from +VGM/+VGS AT commands or events should be between 0 than 15.
2021-02-18 18:32:21 +00:00
Wim Taymans
930b411075 bluez5: set the right volumes on the node 2021-02-18 19:25:04 +01:00