Commit graph

2955 commits

Author SHA1 Message Date
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
Wim Taymans
a243d126db Fix tests, use the right config dir 2021-02-12 10:33:02 +01:00
Wim Taymans
80825aeaea conf: more work on config changes
Add -c option to pipewire to select config file. Use this to select
the uninstalled conf file.
Rename conf properties, prefix with context.
Simplify the main daemon now that everything can go in config.
Simplify pipewire-pulse now that we can put everything in config, it's
now virtually the same as pipewire but with a differenct config file.
Parse server addresses as array of strings.
2021-02-12 10:31:29 +01:00
Wim Taymans
fc90a4e48a Implement config/state file handling
Make methods to load_config and load/save state. For now the config
and state directories are the same but it might not be. Implement
the search path for all config/state files as:

  $XDG_CONFIG_HOME/[$prefix]/$name
  $HOME/.config/[$prefix]/$name
  $PIPEWIRE_CONFIG_DIR/pipewire/[$prefix]/$name
  /etc/pipewire/[$prefix]/$name

Make some config files for jack and RT clients. Make pw-cat use the
client-rt config.

Use core state and config management in media-session.
Move all session manager state and config files to the build dir and
set the PIPEWIRE_CONFIG_DIR to this build dir.
2021-02-12 10:25:11 +01:00
Wim Taymans
c605672d43 Implement per client config files
Move the daemon config file loading to a new conf.c file used by
the context to load the configuration. This replaces the module
profiles and some hacks to move properties around.

If there is nothing other specified with $PIPEWIRE_CONFIG_NAME or
a property, the client.conf file is loaded as a fallback.

Update the session manager config file to load the modules via the
config now. Rename the session modules section to another name.

Update pipewire-pulse to also load a specific pulse property file.
This then makes it pssible to assign specific RT priorities for the
pipewire-pulse process.
2021-02-12 10:07:16 +01:00
Ivan
0d56f717bf style: Reformat config files
Use spaces instead of tabs (as they depend on text editor settings).
Make configuration files more readable and consistent seeing as there
were some mixed indentation and styling.
Also put some logic into styling.
2021-02-12 05:26:16 +00:00
Wim Taymans
6b11bf71f3 media-session: remove unused code 2021-02-11 12:17:00 +01:00
Pauli Virtanen
beaec3d003 bluez5: set initial profile based on what's connected at startup
Set initial device profile according to what's connected at startup,
rather than having media-session try to set it to A2DP (and fail, if the
profile was not connected, resulting to startup in null profile).

This avoids making a codec switch at device startup (we'll stay with
what BlueZ autoconnected us to, usually the previously used codec).
2021-02-11 11:13:42 +00:00
Nicolai Syvertsen
3c0821775f pipewire-pulse: Don't send sink-input volume updates unless it has actually changed 2021-02-10 19:12:10 +01:00
George Kiagiadakis
0ce6de8fdf src: change license (LGPL -> MIT) on left-over LGPL files
Discussed with and approved by Wim
2021-02-10 11:52:09 +00:00
Wim Taymans
2af7f8204a media-session: remove add_spa_lib, we do this in the config 2021-02-10 11:54:10 +01:00
Wim Taymans
895097230d context: add context.module.args property
Add a new property that is passed to the default modules when they
are loaded. This allows basic configuration of the automatically
loaded client modules.
2021-02-10 11:20:56 +01:00
Jonas Holmberg
f977c45240 media-session: add dbus property to media-session 2021-02-09 18:09:33 +00:00
Jonas Holmberg
d624ed26f4 media-session: add alsa.reserve property to alsa-monitor 2021-02-09 18:09:33 +00:00
Wim Taymans
5b36d77ed0 conf: fix the example... 2021-02-09 18:28:10 +01:00
Wim Taymans
c140a573be pulse-server: try to avoid setting the same volume/mute 2021-02-09 18:17:45 +01:00
Wim Taymans
c3c6dcf53f conf: add an example for a virtual source 2021-02-09 18:15:54 +01:00
Wim Taymans
d60f2b9b92 pulse-server: write captured data in fragsize chunks
Keep on queuing chunks of fragsize length until we read all the
captured data. Else we would fall behind and really never catch
up.
2021-02-09 17:37:41 +01:00
Wim Taymans
739f3b9f7f media-session: disable JACK device by default
It is most likely to fail right now.
2021-02-09 17:37:08 +01:00
Wim Taymans
51cfb98ea6 jack: Pass custom flags as port.extra info
Make a port.extra property that contains API specific extra port
information that is passed in the global object properties.
Use this to pass the custom jack flags for a port. Carla uses this
to mark CV ports.
2021-02-09 16:09:53 +01:00
Wim Taymans
e6ea01046e media-session: add some logging to bluez volume handling
See #699
2021-02-09 10:57:16 +01:00
jasker5183
2eaf10d5b3 pipewire.conf Formatting #2 2021-02-09 07:55:48 +00:00
jasker5183
5e2130f6f7 v4l2-monitor.conf Formatting/Punctuation Fixes 2021-02-09 07:54:06 +00:00
jasker5183
20e1b4f639 media-session.conf Formatting/Punctuation 2021-02-09 07:52:34 +00:00